rebase: use 'git stash store' to simplify logic
authorRamkumar Ramachandra <artagnon@gmail.com>
Sat, 15 Jun 2013 13:13:26 +0000 (18:43 +0530)
committerJunio C Hamano <gitster@pobox.com>
Mon, 17 Jun 2013 18:43:24 +0000 (11:43 -0700)
rebase has no reason to know about the implementation of the stash. In
the case when applying the autostash results in conflicts, replace the
relevant code in finish_rebase () to simply call 'git stash store'.

Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
git-rebase.sh
index d0c11a910a69603ac19c83a5d29af9f32f780267..17be3922f8dd0263f89d0595414d13798114386a 100755 (executable)
@@ -153,11 +153,8 @@ finish_rebase () {
                then
                        echo "$(gettext 'Applied autostash.')"
                else
-                       ref_stash=refs/stash &&
-                       >>"$GIT_DIR/logs/$ref_stash" &&
-                       git update-ref -m "autostash" $ref_stash $stash_sha1 ||
-                       die "$(eval_gettext 'Cannot store $stash_sha1')"
-
+                       git stash store -m "autostash" -q $stash_sha1 ||
+                       die "$(eval_gettext "Cannot store \$stash_sha1")"
                        gettext 'Applying autostash resulted in conflicts.
 Your changes are safe in the stash.
 You can run "git stash pop" or "git stash drop" it at any time.