threads / patch / 39495

patchrequest-pull: short sha handling, manual update

Subject: [PATCH] request-pull: short sha handling, manual update

## tl;dr

2 messages between Jun 2, 2015 and Jun 18, 2015. Diffs are folded; open one to read it.

replies: 1people: 1as markdown or json

Petr Stodulka· Jun 2, 2015, 14:14 UTC · lore

request-pull prints incorrectly warn messages about not found commits and man pages don't say anything about todays changed behaviour. People are confused and try look for errors at wrong places. At least these should be fixed/modified.

Warn massage says that commit can't be found ar remote, however there it is in and is missing on local repository in 'many' cases. So I don't know if better solution is check, where commit is truly missing or transform warning message. Something like:

    warn: No match for commit <commit> found at <url> or local repository.
    warn: Are you sure you have synchronized branch with remote repository?

...... man page could be changed like this:

-------------------------------------------------------
Show changes to 2 files +16 −0

Documentation/git-request-pull.txt, git-request-pull.sh

diff --git a/Documentation/git-request-pull.txt 
b/Documentation/git-request-pull.txt
index 283577b..6d34fc7 100644
--- a/Documentation/git-request-pull.txt
+++ b/Documentation/git-request-pull.txt
@@ -73,6 +73,17 @@ then you can ask that to be pulled with
         git request-pull v1.0 https://git.ko.xz/project master:for-linus


+NOTES
+-----
+
+Since git version 2.0.0 is behaviour of git request-pull little different.
+It is recommended use of third argument for each request-pull, otherwise
+you can get error message like:
+
+   warn: No match for commit <commit> found at <url>
+   warn: Are you sure you pushed 'HEAD' there?
+
+
  GIT
  ---
  Part of the linkgit:git[1] suite

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

Second patch provides right processing of third parameter when short 
version of sha hash is used (e.g. 897a111). Now is
supported only full hash, what is different behaviour against first 
parameter or what can be found in other functions. Extra
solves one of cases of wrong warn message.

-------------------------------------------------------
diff --git a/git-request-pull.sh b/git-request-pull.sh
index d5500fd..2dc735e 100755
--- a/git-request-pull.sh
+++ b/git-request-pull.sh
@@ -92,9 +92,11 @@ find_matching_ref='
                 chomp;
                 my ($sha1, $ref, $deref) = /^(\S+)\s+([^^]+)(\S*)$/;
                 my ($pattern);
+               my ($pattern2);
                 next unless ($sha1 eq $headrev);

                 $pattern="/$head\$";
+               $pattern2="^$head";
                 if ($ref eq $head) {
                         $found = $ref;
                 }
@@ -104,6 +106,9 @@ find_matching_ref='
                 if ($sha1 eq $head) {
                         $found = $sha1;
                 }
+               elsif ($sha1 =~ /$pattern2/ and (length $head) gt 7) {
+                       $found = $sha1
+               }
         }
         if ($found) {
                 print "$found\n";
-------------------------------------------------------
Petr Stodulka· Jun 18, 2015, 17:20 UTC · re: Petr Stodulka · lore

Re: [PATCH] request-pull: short sha handling, manual update

Hi folks, can you someone look at it? Or were these troubles mentioned somewhere earlier and I miss that?

On 2.6.2015 16:14, Petr Stodulka wrote:
Show 81 quoted lines
> request-pull prints incorrectly warn messages about not found commits 
> and man pages don't say
> anything about todays changed behaviour. People are confused and try 
> look for errors at wrong places.
> At least these should be fixed/modified.
>
> Warn massage says that commit can't be found ar remote, however there 
> it is in and is missing on local repository
> in 'many' cases. So I don't know if better solution is check, where 
> commit is truly missing or transform warning message.
> Something like:
>
>    warn: No match for commit <commit> found at <url> or local repository.
>    warn: Are you sure you have synchronized branch with remote 
> repository?
>
> ......
> man page could be changed like this:
>
> -------------------------------------------------------
> diff --git a/Documentation/git-request-pull.txt 
> b/Documentation/git-request-pull.txt
> index 283577b..6d34fc7 100644
> --- a/Documentation/git-request-pull.txt
> +++ b/Documentation/git-request-pull.txt
> @@ -73,6 +73,17 @@ then you can ask that to be pulled with
>         git request-pull v1.0 https://git.ko.xz/project master:for-linus
>
>
> +NOTES
> +-----
> +
> +Since git version 2.0.0 is behaviour of git request-pull little 
> different.
> +It is recommended use of third argument for each request-pull, otherwise
> +you can get error message like:
> +
> +   warn: No match for commit <commit> found at <url>
> +   warn: Are you sure you pushed 'HEAD' there?
> +
> +
>  GIT
>  ---
>  Part of the linkgit:git[1] suite
>
> -------------------------------------------------------
>
> Second patch provides right processing of third parameter when short 
> version of sha hash is used (e.g. 897a111). Now is
> supported only full hash, what is different behaviour against first 
> parameter or what can be found in other functions. Extra
> solves one of cases of wrong warn message.
>
> -------------------------------------------------------
> diff --git a/git-request-pull.sh b/git-request-pull.sh
> index d5500fd..2dc735e 100755
> --- a/git-request-pull.sh
> +++ b/git-request-pull.sh
> @@ -92,9 +92,11 @@ find_matching_ref='
>                 chomp;
>                 my ($sha1, $ref, $deref) = /^(\S+)\s+([^^]+)(\S*)$/;
>                 my ($pattern);
> +               my ($pattern2);
>                 next unless ($sha1 eq $headrev);
>
>                 $pattern="/$head\$";
> +               $pattern2="^$head";
>                 if ($ref eq $head) {
>                         $found = $ref;
>                 }
> @@ -104,6 +106,9 @@ find_matching_ref='
>                 if ($sha1 eq $head) {
>                         $found = $sha1;
>                 }
> +               elsif ($sha1 =~ /$pattern2/ and (length $head) gt 7) {
> +                       $found = $sha1
> +               }
>         }
>         if ($found) {
>                 print "$found\n";
> -------------------------------------------------------

← back to recent threads