Re: [PATCH] subtree: fix split processing with multiple subtrees present

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

 



"Zach FettersMoore via GitGitGadget" <gitgitgadget@xxxxxxxxx>
writes:

>  contrib/subtree/git-subtree.sh | 17 +++++++++++++++++
>  1 file changed, 17 insertions(+)
>
> diff --git a/contrib/subtree/git-subtree.sh b/contrib/subtree/git-subtree.sh
> index e0c5d3b0de6..e9250dfb019 100755
> --- a/contrib/subtree/git-subtree.sh
> +++ b/contrib/subtree/git-subtree.sh
> @@ -778,12 +778,29 @@ ensure_valid_ref_format () {
>  		die "fatal: '$1' does not look like a ref"
>  }
>  
> +# Usage: check if a commit from another subtree should be ignored from processing for splits
> +should_ignore_subtree_commit () {
> +  if [ "$(git log -1 --grep="git-subtree-dir:" $1)" ]
> +  then
> +    if [[ -z "$(git log -1 --grep="git-subtree-mainline:" $1)" && -z "$(git log -1 --grep="git-subtree-dir: $dir$" $1)" ]]
> +    then
> +      return 0
> +    fi
> +  fi
> +  return 1
> +}
>
>  # Usage: process_split_commit REV PARENTS
>  process_split_commit () {
>  	assert test $# = 2
>  	local rev="$1"
>  	local parents="$2"
>  
> +    if should_ignore_subtree_commit $rev
> +    then
> +	    return
> +    fi
> +

Please do not violate Documentation/CodingGuidelines for our shell
scripted Porcelain, even if it is a script in contrib/ and also
please avoid bash-isms.

Also doesn't "subtree" have its own test?  If this change is a fix
for some problem(s), can we have a test or two that demonstrate how
the current code without the patch is broken?

Thanks.




[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