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

Re: [PATCH 7/7] rebase: implement --[no-]autostash and rebase.autostash

From
Junio C Hamano <gitster@pobox.com>
Date
May 13, 2013, 06:28 UTC
Message-ID
<7vd2svqtqd.fsf@alter.siamese.dyndns.org>
In-Reply-To
<1368359801-28121-8-git-send-email-artagnon@gmail.com>
Ramkumar Ramachandra <artagnon@gmail.com> writes:
Show 12 quoted lines
> +finish_rebase () {
> +	if test -f "$state_dir/autostash"
> +	then
> +		stash_sha1=$(cat "$state_dir/autostash")
> +		if git stash apply $stash_sha1 2>&1 >/dev/null
> +		then
> +			echo "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')"
Writing it like this:
			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')"
with a blank line before the next "echo", it would be more readable.

As I said in a separate message, having a code that knows where "stash" is and how it is organized outside the implementation of "git stash" is less than ideal. It probably makes more sense to let programs like this to say:

			git stash store -m "autostash" $stash_sha1 || exit
> +			echo "
> +$(gettext 'Applying autostash resulted in conflicts.
> +Your changes are safe in the stash.
> +You can apply or drop it at any time.')"
This feels funny.  Why not
			gettext "$msg"
without an extra command substitution with an echo?
Previous: Ramkumar RamachandraNext: Ramkumar Ramachandra
Message 9 of 22 in “rebase.autostash completed”
  1. 0/7 rebase.autostash completedRamkumar Ramachandra, May 12, 2013
  2. 1/7 am: tighten a conditional that checks for $dotestRamkumar Ramachandra, May 12, 2013
  3. 2/7 rebase -i: don't error out if $state_dir already existsRamkumar Ramachandra, May 12, 2013
  4. 3/7 rebase: prepare to do generic housekeepingRamkumar Ramachandra, May 12, 2013
  5. 4/7 am: return control to caller, for housekeepingRamkumar Ramachandra, May 12, 2013
  6. 5/7 rebase -i: return control to caller, for housekeepingRamkumar Ramachandra, May 12, 2013
  7. 6/7 rebase --merge: return control to caller, for housekeepingRamkumar Ramachandra, May 12, 2013
  8. 7/7 rebase: implement --[no-]autostash and rebase.autostashRamkumar Ramachandra, May 12, 2013
  9. Junio C HamanoMay 13, 2013
  10. Ramkumar RamachandraMay 13, 2013
  11. Junio C HamanoMay 13, 2013
  12. Ramkumar RamachandraMay 13, 2013
  13. Matthieu MoyMay 13, 2013
  14. Ramkumar RamachandraMay 13, 2013
  15. Matthieu MoyMay 13, 2013
  16. Junio C HamanoMay 13, 2013
  17. Ramkumar RamachandraMay 13, 2013
  18. Matthieu MoyMay 13, 2013
  19. Junio C HamanoMay 13, 2013
  20. Junio C HamanoMay 13, 2013
  21. Ramkumar RamachandraMay 13, 2013
  22. Junio C HamanoMay 13, 2013

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.