+2008-02-17 Bruno Haible <bruno@clisp.org>
+
+ * lib/git-merge-changelog.c: Include c-strstr.h.
+ (main): Support the "git pull --rebase" situation.
+ * modules/git-merge-changelog (Depends-on): Add c-strstr.
+ Reported by Eric Blake.
+
2008-02-16 Eric Blake <ebb9@byu.net>
Avoid doubling \ in common case of "c-maybe" quoting style.
being merged in.
In case of a "git stash apply" or of an upstream pull (e.g. from a subsystem
- maintainer to a central maintainer):
+ maintainer to a central maintainer) or of a downstream pull with --rebase:
2. %A = The file's newest pulled contents; modified by other committers.
3. %B = The user's newest copy of the file; modified by the user.
- In case of a downstream pull (e.g. from a central repository to the user):
+ In case of a downstream pull (e.g. from a central repository to the user)
+ or of an upstream pull with --rebase:
2. %A = The user's newest copy of the file; modified by the user.
3. %B = The file's newest pulled contents; modified by other committers.
#include "xmalloca.h"
#include "fstrcmp.h"
#include "minmax.h"
+#include "c-strstr.h"
#include "fwriteerror.h"
#define ASSERT(expr) \
"git pull" only to pull downstream.
How to distinguish these situation? There are several hints:
- - During a "git stash apply", GIT_REFLOG_ACTION is not set. During
- a "git pull", it is set to 'pull '.
+ - During a "git stash apply", GIT_REFLOG_ACTION is not set. During
+ a "git pull", it is set to 'pull '. During a "git pull --rebase",
+ it is set to 'pull --rebase'.
- During a "git stash apply", there is an environment variable of
the form GITHEAD_<40_hex_digits>='Stashed changes'. */
{
printf ("GIT_REFLOG_ACTION=|%s|\n", var);
#endif
if (var != NULL
- && (strncmp (var, "pull", 4) == 0
+ && ((strncmp (var, "pull", 4) == 0
+ && c_strstr (var, " --rebase") == NULL)
|| strncmp (var, "merge origin", 12) == 0))
downstream = true;
else
sprintf (buf, "head -1 %s", destination_file_name); system (buf);
printf ("First line of %%B:\n");
sprintf (buf, "head -1 %s", other_file_name); system (buf);
- printf ("Guessing direction: %sstream\n", downstream ? "down" : "up");
+ printf ("Guessing calling convention: %s\n",
+ downstream
+ ? "%A = modified by user, %B = upstream"
+ : "%A = upstream, %B = modified by user");
}
#endif