[PATCH v2 0/6] Fix merge restore state

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



MAINTAINER NOTE: Rebased on latest main/master. (In particular, needs
vd/sparse-stash; otherwise, the changes made here regress a
ensure-full-index testcase in t1092). Also, this fixes issues that predate
the v2.37 cycle, so this series can wait until v2.38 opens up.

Other note: If this rounds needs updates, ZheNing Hu may be the one to
respond and make any necessary updates, as per [1].

----------------------------------------------------------------------------

This is a simple series to fix restore_state() in builtin/merge.c, fixing
the issue reported by ZheNing Hu over here:
https://lore.kernel.org/git/CAOLTT8R7QmpvaFPTRs3xTpxr7eiuxF-ZWtvUUSC0-JOo9Y+SqA@xxxxxxxxxxxxxx/

Changes since v1:

 * Rebased
 * Included Junio's patch providing more testcases from
   https://lore.kernel.org/git/xmqqbkvtnyae.fsf@gitster.g/
 * Added three new patches to fix issues highlighted by Junio's testcases,
   in particular to (a) fix stashing with racy-dirty files present, (b) fix
   restoring staged state in restore_state(), and (c) ensure we can restore
   pre-merge state. All three were long-standing issues that we just hadn't
   noticed yet and thus are useful fixes on their own. However, my fix from
   v1 (which still remains as the final patch) does make it easier to notice
   these issues, and in particular that combined with Junio's new testcases
   unearthed those problems.

[1]
https://lore.kernel.org/git/CAOLTT8RpGGioOyaMw5tkeWXmHpOaBW9UH8JghUvBRQ50ZcDdYQ@xxxxxxxxxxxxxx/

Elijah Newren (5):
  merge: remove unused variable
  merge: fix save_state() to work when there are racy-dirty files
  merge: make restore_state() restore staged state too
  merge: ensure we can actually restore pre-merge state
  merge: do not exit restore_state() prematurely

Junio C Hamano (1):
  t6424: make sure a failed merge preserves local changes

 builtin/merge.c                          | 32 ++++++++++++++----------
 t/t6424-merge-unrelated-index-changes.sh | 32 ++++++++++++++++++++++--
 t/t7607-merge-state.sh                   | 25 ++++++++++++++++++
 3 files changed, 74 insertions(+), 15 deletions(-)
 create mode 100755 t/t7607-merge-state.sh


base-commit: 8ddf593a250e07d388059f7e3f471078e1d2ed5c
Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-1231%2Fnewren%2Ffix-merge-restore-state-v2
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-1231/newren/fix-merge-restore-state-v2
Pull-Request: https://github.com/gitgitgadget/git/pull/1231

Range-diff vs v1:

 -:  ----------- > 1:  6147e72c309 t6424: make sure a failed merge preserves local changes
 1:  042d624b815 = 2:  230d84f09c8 merge: remove unused variable
 -:  ----------- > 3:  89e5e633241 merge: fix save_state() to work when there are racy-dirty files
 -:  ----------- > 4:  4a8b7c9e06d merge: make restore_state() restore staged state too
 -:  ----------- > 5:  a03075167c1 merge: ensure we can actually restore pre-merge state
 2:  88bdca72a78 ! 6:  0783b48c121 merge: make restore_state() do as its name says
     @@ Metadata
      Author: Elijah Newren <newren@xxxxxxxxx>
      
       ## Commit message ##
     -    merge: make restore_state() do as its name says
     +    merge: do not exit restore_state() prematurely
      
          Previously, if the user:
      
     @@ Commit message
       ## builtin/merge.c ##
      @@ builtin/merge.c: static void restore_state(const struct object_id *head,
       {
     - 	const char *args[] = { "stash", "apply", NULL, NULL };
     + 	const char *args[] = { "stash", "apply", "--index", NULL, NULL };
       
      -	if (is_null_oid(stash))
      -		return;
     @@ builtin/merge.c: static void restore_state(const struct object_id *head,
      +	if (is_null_oid(stash))
      +		goto refresh_cache;
      +
     - 	args[2] = oid_to_hex(stash);
     + 	args[3] = oid_to_hex(stash);
       
       	/*
      @@ builtin/merge.c: static void restore_state(const struct object_id *head,

-- 
gitgitgadget



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux