git/list[1] front-page[2] threads[3] people[4] search[5] about
 

`pull --rebase --autostash` fails when fast forward in dirty repo

From
TBTyler Brazier <tylerbrazier@gmail.com>
Date
May 21, 2017, 05:17 UTC
Message-ID
<CAAZatrCaoB7EXVrCvC9RKmO02G5xcp8GPBaJefHfv7zAXVpL3Q@mail.gmail.com>
Hi,

This script explains and tests what's going on: https://gist.github.com/tylerbrazier/4478e76fe44bf6657d4d3da6c789531d

pull is failing because it shortcuts to --ff-only then calls run_merge(), which does not know how to autostash. Removing the shortcut fixes the problem:

diff --git a/builtin/pull.c b/builtin/pull.c
index dd1a4a94e..225a59f5f 100644
--- a/builtin/pull.c
+++ b/builtin/pull.c
@@ -868,11 +868,6 @@ int cmd_pull(int argc, const char **argv, const
char *prefix)
      head = lookup_commit_reference(orig_head.hash);
      commit_list_insert(head, &list);
      merge_head = lookup_commit_reference(merge_heads.oid[0].hash);
-     if (is_descendant_of(merge_head, list)) {
-         /* we can fast-forward this without invoking rebase */
-         opt_ff = "--ff-only";
-         return run_merge();
-     }
      return run_rebase(&curr_head, merge_heads.oid, &rebase_fork_point);
  } else {
      return run_merge();
Next: Jeff King
Message 1 of 8 in “`pull --rebase --autostash` fails when fast forward in dirty repo”
  1. Tyler BrazierMay 21, 2017
  2. Jeff KingMay 23, 2017
  3. Junio C HamanoMay 23, 2017
  4. Jeff KingMay 25, 2017
  5. Jeff KingMay 25, 2017
  6. Junio C HamanoMay 25, 2017
  7. Tyler BrazierMay 26, 2017
  8. Junio C HamanoMay 26, 2017

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.