git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Ramkumar Ramachandra <artagnon@gmail.com>
Cc: Git List <git@vger.kernel.org>,
	Martin von Zweigbergk <martinvonz@gmail.com>,
	Johannes Schindelin <Johannes.Schindelin@gmx.de>
Subject: Re: [PATCH 4/7] am: don't do housekeeping when rebasing
Date: Tue, 23 Apr 2013 09:51:19 -0700	[thread overview]
Message-ID: <7v4nexjim0.fsf@alter.siamese.dyndns.org> (raw)
In-Reply-To: <1366725724-1016-5-git-send-email-artagnon@gmail.com> (Ramkumar Ramachandra's message of "Tue, 23 Apr 2013 19:32:01 +0530")

Ramkumar Ramachandra <artagnon@gmail.com> writes:

> Perform these two tasks:
>
>     git gc --auto
>     rm -fr "$dotest"
>
> only when not called with --rebasing (from git-rebase--am.sh).
> Otherwise, return control to the caller so that it can do the needful.
> The advantage of doing this is that the caller can implement a generic
> cleanup routine (that possibly does other things) independent of
> specific rebases.

The above justification and the patch text make a lot of sense, but
they make me wonder why there is no corresponding removal from the
other git-rebase--*backend*.

Unconditional changes from "exit" to "return $?" looked somewhat
suspicious, but this is a sourced script so it should be safe.

>  git-am.sh         | 9 +++++++--
>  git-rebase--am.sh | 8 ++++----
>  git-rebase.sh     | 7 +++++++
>  3 files changed, 18 insertions(+), 6 deletions(-)
>
> diff --git a/git-am.sh b/git-am.sh
> index f4ef8fc..47c1021 100755
> --- a/git-am.sh
> +++ b/git-am.sh
> @@ -904,5 +904,10 @@ if test -s "$dotest"/rewritten; then
>      fi
>  fi
>  
> -rm -fr "$dotest"
> -git gc --auto
> +# If am was called with --rebasing (from git-rebase--am), it's up to
> +# the caller to take care of housekeeping.
> +if ! test -f "$dotest/rebasing"
> +then
> +	rm -fr "$dotest"
> +	git gc --auto
> +fi
> diff --git a/git-rebase--am.sh b/git-rebase--am.sh
> index f84854f..8230094 100644
> --- a/git-rebase--am.sh
> +++ b/git-rebase--am.sh
> @@ -7,12 +7,12 @@ case "$action" in
>  continue)
>  	git am --resolved --resolvemsg="$resolvemsg" &&
>  	move_to_original_branch
> -	exit
> +	return $?
>  	;;
>  skip)
>  	git am --skip --resolvemsg="$resolvemsg" &&
>  	move_to_original_branch
> -	exit
> +	return $?
>  	;;
>  esac
>  
> @@ -56,7 +56,7 @@ else
>  
>  		As a result, git cannot rebase them.
>  		EOF
> -		exit $?
> +		return $?
>  	fi
>  
>  	git am $git_am_opt --rebasing --resolvemsg="$resolvemsg" <"$GIT_DIR/rebased-patches"
> @@ -68,7 +68,7 @@ fi
>  if test 0 != $ret
>  then
>  	test -d "$state_dir" && write_basic_state
> -	exit $ret
> +	return $ret
>  fi
>  
>  move_to_original_branch
> diff --git a/git-rebase.sh b/git-rebase.sh
> index b2f1c76..8412d81 100755
> --- a/git-rebase.sh
> +++ b/git-rebase.sh
> @@ -150,6 +150,13 @@ run_specific_rebase () {
>  		autosquash=
>  	fi
>  	. git-rebase--$type
> +	ret=$?
> +	if test $ret = 0
> +	then
> +		git gc --auto &&
> +		rm -rf "$state_dir"
> +	fi
> +	exit $ret
>  }
>  
>  run_pre_rebase_hook () {

  reply	other threads:[~2013-04-23 16:51 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-23 14:01 [PATCH 0/7] Introduce rebase.autostash Ramkumar Ramachandra
2013-04-23 14:01 ` [PATCH 1/7] am: suppress error output from a conditional Ramkumar Ramachandra
2013-04-23 14:38   ` Martin von Zweigbergk
2013-04-23 16:29     ` Junio C Hamano
2013-04-23 16:31     ` Ramkumar Ramachandra
2013-04-23 17:29       ` Junio C Hamano
2013-04-23 17:31         ` Ramkumar Ramachandra
2013-04-23 14:01 ` [PATCH 2/7] rebase -i: don't error out if $state_dir already exists Ramkumar Ramachandra
2013-04-23 14:45   ` Martin von Zweigbergk
2013-04-23 16:35   ` Junio C Hamano
2013-04-23 16:38     ` Ramkumar Ramachandra
2013-04-23 14:02 ` [PATCH 3/7] am: tighten a conditional that checks for $dotest Ramkumar Ramachandra
2013-04-23 16:45   ` Junio C Hamano
2013-04-23 14:02 ` [PATCH 4/7] am: don't do housekeeping when rebasing Ramkumar Ramachandra
2013-04-23 16:51   ` Junio C Hamano [this message]
2013-04-23 14:02 ` [PATCH 5/7] rebase -i: return control to the caller, for housekeeping Ramkumar Ramachandra
2013-04-23 16:51   ` Martin von Zweigbergk
2013-04-25 14:30     ` Ramkumar Ramachandra
2013-04-23 16:57   ` Junio C Hamano
2013-04-23 14:02 ` [PATCH 6/7] sh-setup: introduce require_clean_work_tree --quiet Ramkumar Ramachandra
2013-04-23 17:00   ` Junio C Hamano
2013-04-23 14:02 ` [PATCH 7/7] rebase: implement --[no-]autostash and rebase.autostash Ramkumar Ramachandra
2013-04-23 17:07   ` Junio C Hamano
2013-04-23 17:34     ` Junio C Hamano
2013-04-23 17:37       ` Ramkumar Ramachandra
2013-04-23 22:45   ` Phil Hord
2013-04-24  8:27     ` Ramkumar Ramachandra
2013-04-24 17:52     ` Matthieu Moy

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7v4nexjim0.fsf@alter.siamese.dyndns.org \
    --to=gitster@pobox.com \
    --cc=Johannes.Schindelin@gmx.de \
    --cc=artagnon@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=martinvonz@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).