pkgsrc-Changes archive

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

CVS commit: pkgsrc/devel/git-cinnabar



Module Name:    pkgsrc
Committed By:   riastradh
Date:           Mon Dec 16 00:41:42 UTC 2024

Modified Files:
        pkgsrc/devel/git-cinnabar: Makefile distinfo
Added Files:
        pkgsrc/devel/git-cinnabar/patches: patch-src_main.rs patch-tests_push.t

Log Message:
devel/git-cinnabar: Add patches to fix spurious git push success.

PKGREVISION++

(No change to devel/py-hg-cinnabarclone PKGREVISION even though the
patch also applies to it, because the patch doesn't change any of the
content of the py-hg-cinnabarclone package, which consists mainly of
one .py file in git-cinnabar.  The patch is applied merely for the
convenience of sharing distinfo between the two packages.)

Derived from the current state of:

https://github.com/glandium/git-cinnabar/pull/342


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.23 pkgsrc/devel/git-cinnabar/Makefile
cvs rdiff -u -r1.8 -r1.9 pkgsrc/devel/git-cinnabar/distinfo
cvs rdiff -u -r0 -r1.1 pkgsrc/devel/git-cinnabar/patches/patch-src_main.rs \
    pkgsrc/devel/git-cinnabar/patches/patch-tests_push.t

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: pkgsrc/devel/git-cinnabar/Makefile
diff -u pkgsrc/devel/git-cinnabar/Makefile:1.22 pkgsrc/devel/git-cinnabar/Makefile:1.23
--- pkgsrc/devel/git-cinnabar/Makefile:1.22     Mon Dec 16 00:41:19 2024
+++ pkgsrc/devel/git-cinnabar/Makefile  Mon Dec 16 00:41:41 2024
@@ -1,7 +1,8 @@
-# $NetBSD: Makefile,v 1.22 2024/12/16 00:41:19 riastradh Exp $
+# $NetBSD: Makefile,v 1.23 2024/12/16 00:41:41 riastradh Exp $
 
 .include "Makefile.common"
 
+PKGREVISION=   1
 CATEGORIES=    devel
 
 MAINTAINER=    pkgsrc-users%NetBSD.org@localhost

Index: pkgsrc/devel/git-cinnabar/distinfo
diff -u pkgsrc/devel/git-cinnabar/distinfo:1.8 pkgsrc/devel/git-cinnabar/distinfo:1.9
--- pkgsrc/devel/git-cinnabar/distinfo:1.8      Thu Dec  5 02:31:30 2024
+++ pkgsrc/devel/git-cinnabar/distinfo  Mon Dec 16 00:41:41 2024
@@ -1,4 +1,4 @@
-$NetBSD: distinfo,v 1.8 2024/12/05 02:31:30 riastradh Exp $
+$NetBSD: distinfo,v 1.9 2024/12/16 00:41:41 riastradh Exp $
 
 BLAKE2s (addr2line-0.24.1.crate) = 6b7b4e5845873018da12292d582de9e8ec0be0edbac314cbbbfb7dad89d7a983
 SHA512 (addr2line-0.24.1.crate) = ffa53fcfbbccdec943410083aa5f44e93122e0b40dc45acfe00b454a02c5575549e9a61807d87080d1677da807fef695b6676036fec3ca079d2b841794dbc0b5
@@ -412,5 +412,7 @@ BLAKE2s (zstd-sys-2.0.13+zstd.1.5.6.crat
 SHA512 (zstd-sys-2.0.13+zstd.1.5.6.crate) = c1f0176ebd0914879d0060796776c7fe376293ce9bc9f8f07ee3b809932a75aa033881d59a1bc99b6cd9af85b8e225fc09bcfc96013e556d7c11f155b759ecbf
 Size (zstd-sys-2.0.13+zstd.1.5.6.crate) = 749090 bytes
 SHA1 (patch-git-core_ci_run-test-slice.sh) = 9c7bc2b52c677d96d77a4d842650828a23c3eccc
+SHA1 (patch-src_main.rs) = 13681decb7b9f1a4bd5876a2c651320660fb2935
 SHA1 (patch-tests_cinnabarclone.t) = 054754e932eb52a04001da5cae96c5582dfacddc
 SHA1 (patch-tests_push-refs.t) = c6de59558337c8fe193df7166a9a4179cf3e14ca
+SHA1 (patch-tests_push.t) = e95d39ba32fcd0921da4e59be5bbc71df6355fee

Added files:

Index: pkgsrc/devel/git-cinnabar/patches/patch-src_main.rs
diff -u /dev/null pkgsrc/devel/git-cinnabar/patches/patch-src_main.rs:1.1
--- /dev/null   Mon Dec 16 00:41:42 2024
+++ pkgsrc/devel/git-cinnabar/patches/patch-src_main.rs Mon Dec 16 00:41:41 2024
@@ -0,0 +1,55 @@
+$NetBSD: patch-src_main.rs,v 1.1 2024/12/16 00:41:41 riastradh Exp $
+
+Make git push fail with nonzero status when rejected upstream.
+https://github.com/glandium/git-cinnabar/issues/338
+https://github.com/glandium/git-cinnabar/issues/341
+https://github.com/glandium/git-cinnabar/pull/342
+
+--- src/main.rs.orig   2024-09-30 20:35:52.000000000 +0000
++++ src/main.rs
+@@ -4845,25 +4845,29 @@ fn remote_helper_push(
+                 let response = conn.unbundle(heads, file);
+                 match response {
+                     UnbundleResponse::Bundlev2(data) => {
+-                        let mut bundle = BundleReader::new(data).unwrap();
+-                        while let Some(part) = bundle.next_part().unwrap() {
+-                            match part.part_type.as_bytes() {
+-                                b"reply:changegroup" => {
+-                                    // TODO: should check in-reply-to param.
+-                                    let response = part.get_param("return").unwrap();
+-                                    result = u32::from_str(response).ok();
+-                                }
+-                                b"error:abort" => {
+-                                    let mut message =
+-                                        part.get_param("message").unwrap().to_string();
+-                                    if let Some(hint) = part.get_param("hint") {
+-                                        message.push_str("\n\n");
+-                                        message.push_str(hint);
++                        if let Ok(mut bundle) = BundleReader::new(data) {
++                            while let Ok(Some(part)) = bundle.next_part() {
++                                match part.part_type.as_bytes() {
++                                    b"reply:changegroup" => {
++                                        // TODO: should check in-reply-to param.
++                                        let response = part.get_param("return").unwrap();
++                                        result = u32::from_str(response).ok();
++                                    }
++                                    b"error:abort" => {
++                                        let mut message =
++                                            part.get_param("message").unwrap().to_string();
++                                        if let Some(hint) = part.get_param("hint") {
++                                            message.push_str("\n\n");
++                                            message.push_str(hint);
++                                        }
++                                        error!(target: "root", "{}", message);
++                                        pushed = ChangesetHeads::new();
+                                     }
+-                                    error!(target: "root", "{}", message);
++                                    _ => {}
+                                 }
+-                                _ => {}
+                             }
++                        } else {
++                            pushed = ChangesetHeads::new();
+                         }
+                     }
+                     UnbundleResponse::Raw(response) => {
Index: pkgsrc/devel/git-cinnabar/patches/patch-tests_push.t
diff -u /dev/null pkgsrc/devel/git-cinnabar/patches/patch-tests_push.t:1.1
--- /dev/null   Mon Dec 16 00:41:42 2024
+++ pkgsrc/devel/git-cinnabar/patches/patch-tests_push.t        Mon Dec 16 00:41:41 2024
@@ -0,0 +1,104 @@
+$NetBSD: patch-tests_push.t,v 1.1 2024/12/16 00:41:41 riastradh Exp $
+
+Make git push fail with nonzero status when rejected upstream.
+https://github.com/glandium/git-cinnabar/issues/338
+https://github.com/glandium/git-cinnabar/issues/341
+https://github.com/glandium/git-cinnabar/pull/342
+
+--- tests/push.t.orig  2024-09-30 20:35:52.000000000 +0000
++++ tests/push.t
+@@ -516,3 +516,94 @@ different than without the feature enabl
+   * 687e015f9f646bb19797d991f2f53087297fbe14 c
+   * d04f6df4abe2870ceb759263ee6aaa9241c4f93c b
+   * 8b86a58578d5270969543e287634e3a2f122a338 a
++
++Create a new commit in a divergent Mercurial clone.
++
++  $ ABX=$(pwd)/abx
++  $ hg clone -q -u 636e60525868096cbdc961870493510558f41d2f abc abx
++  $ cd abx
++  $ create x
++  $ cd ..
++  $ hg -R $ABX log -G --template '{node} {branch} {desc}'
++  @  2b10b3a49ff6e308c904c2c626d7e449480b6403 default x
++  |
++  | o  bd623dea939349b06a47d5dce064255e5f1d9ec1 default c
++  |/
++  o  636e60525868096cbdc961870493510558f41d2f default b
++  |
++  o  f92470d7f6966a39dfbced6a525fe81ebf5c37b9 default a
++  
++Grab the divergent commit in git:
++
++  $ git -C abc-git -c fetch.prune=true fetch -q hg::$ABX
++  $ git -C abc-git log --graph --oneline --no-abbrev-commit FETCH_HEAD
++  * 846552c6f25c1b46e784f59d8249fb31afac2996 x
++  * bc90f2819ad12e294b313097b8763d26ca0c08ae b
++  * 8b86a58578d5270969543e287634e3a2f122a338 a
++
++Verify that pushes to the divergent hg clone are rejected by a
++reject_new_heads hook:
++XXX This should fail with nonzero exit status and not update remote refs:
++https://github.com/glandium/git-cinnabar/issues/341
++
++  $ cat <<EOF >repo/.hg/hgrc
++  > [hooks]
++  > pretxnclose.reject_new_heads = python:hgext.hooklib.reject_new_heads.hook
++  > EOF
++  $ git -C abc-git push -f origin 846552c6f25c1b46e784f59d8249fb31afac2996:branches/default/tip
++  remote: adding changesets
++  remote: adding manifests
++  remote: adding file changes
++  remote: error: pretxnclose.reject_new_heads hook failed: Changes on branch 'default' resulted in multiple heads
++  remote: transaction abort!
++  remote: rollback completed
++  \r (no-eol) (esc)
++  ERROR Changes on branch 'default' resulted in multiple heads
++  To hg::.*/push.t/repo (re)
++   ! [remote rejected] 846552c6f25c1b46e784f59d8249fb31afac2996 -> branches/default/tip (nothing changed on remote)
++  error: failed to push some refs to 'hg::.*/push.t/repo' (re)
++  [1]
++  $ rm repo/.hg/hgrc
++  $ git -C abc-git log --graph --remotes --oneline --no-abbrev-commit
++  * 687e015f9f646bb19797d991f2f53087297fbe14 c
++  * d04f6df4abe2870ceb759263ee6aaa9241c4f93c b
++  * 8b86a58578d5270969543e287634e3a2f122a338 a
++  $ hg -R $REPO log -G --template '{node} {branch} {desc}'
++  o  c70941aaa15aa6e5feae28164438f13dc3cd7b8e default c
++  |
++  o  29872b591f8d41c613bbfad38722824ab0457f17 default b
++  |
++  o  f92470d7f6966a39dfbced6a525fe81ebf5c37b9 default a
++  
++
++Verify that pushes to the divergent clone are rejected by a broken
++hook:
++
++  $ cat <<EOF >repo/.hg/hgrc
++  > [hooks]
++  > pretxnclose = python:/nonexistent:fail
++  > EOF
++  $ git -C abc-git push -f origin 846552c6f25c1b46e784f59d8249fb31afac2996:branches/default/tip
++  remote: adding changesets
++  remote: adding manifests
++  remote: adding file changes
++  remote: loading pretxnclose hook failed:
++  remote: transaction abort!
++  remote: rollback completed
++  remote: abort: No such file or directory: '/nonexistent'
++  To hg::.*/push.t/repo (re)
++   ! [remote rejected] 846552c6f25c1b46e784f59d8249fb31afac2996 -> branches/default/tip (nothing changed on remote)
++  error: failed to push some refs to 'hg::.*/push.t/repo' (re)
++  [1]
++  $ rm repo/.hg/hgrc
++  $ git -C abc-git log --graph --remotes --oneline --no-abbrev-commit
++  * 687e015f9f646bb19797d991f2f53087297fbe14 c
++  * d04f6df4abe2870ceb759263ee6aaa9241c4f93c b
++  * 8b86a58578d5270969543e287634e3a2f122a338 a
++  $ hg -R $REPO log -G --template '{node} {branch} {desc}'
++  o  c70941aaa15aa6e5feae28164438f13dc3cd7b8e default c
++  |
++  o  29872b591f8d41c613bbfad38722824ab0457f17 default b
++  |
++  o  f92470d7f6966a39dfbced6a525fe81ebf5c37b9 default a
++  



Home | Main Index | Thread Index | Old Index