Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
2347a8b
proper pre-push hook implementation
extrawurst Dec 17, 2025
36bb24a
better error handling, fix upstream sha
extrawurst Dec 17, 2025
3b885fe
hooksresult refactor
extrawurst Dec 17, 2025
b90a365
explicit drop semantics
extrawurst Dec 17, 2025
96f18c9
feed correct stdin to pre-push hook
extrawurst Dec 17, 2025
5aab2e0
use correct remote advertised tips for pre_push hook
extrawurst Dec 17, 2025
f8ce43f
fix branch destination ref logic
extrawurst Dec 17, 2025
5d7f749
skip remote access if pre_push not set
extrawurst Dec 17, 2025
4a33af4
provide same creds to hooks call as to push
extrawurst Dec 17, 2025
a3c73ef
cleanup
extrawurst Dec 17, 2025
b1802f4
simplify and document
extrawurst Dec 17, 2025
a478074
improve error handling
extrawurst Dec 17, 2025
a81cc14
simplify stdin
extrawurst Dec 17, 2025
cf8d1cb
revert unrelated change
extrawurst Dec 17, 2025
2561dc9
add comment
extrawurst Dec 17, 2025
8d2af0e
cleanup uneeded allow
extrawurst Dec 17, 2025
bc0f381
cleanup: no need to be public
extrawurst Dec 17, 2025
b92803b
integration test
extrawurst Dec 17, 2025
61951ff
potential fix for broken pipe ci tests failing
extrawurst Dec 17, 2025
6998e42
add more logging for diagnostics
extrawurst Dec 17, 2025
d1dc562
Merge branch 'master' into pre-push-with-lfs
extrawurst Jan 15, 2026
a1ae92b
cleanup feedback review
extrawurst Jan 15, 2026
a8f80a1
clearer api design
extrawurst Jan 15, 2026
555d915
clearer api design: use did_run_hook in tests
extrawurst Jan 15, 2026
38c55af
clearer api design: use did_run_hook in tests
extrawurst Jan 16, 2026
72283e7
fix message
extrawurst Jan 16, 2026
8c3493a
remove must_use
extrawurst Jan 16, 2026
7327c28
more context
extrawurst Jan 16, 2026
a65e8b9
extend test
extrawurst Jan 16, 2026
ee16934
consolidate tests, cleanup
extrawurst Jan 16, 2026
129f481
cleanup
extrawurst Jan 16, 2026
dcd9e00
remote url lookup inside push_hook
extrawurst Jan 16, 2026
49ac056
cleanup bash based asserting
extrawurst Jan 16, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
provide same creds to hooks call as to push
  • Loading branch information
extrawurst committed Dec 18, 2025
commit 4a33af43977d394abee2d81d1465ba54c39a20f0
11 changes: 9 additions & 2 deletions asyncgit/src/sync/hooks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ pub fn advertised_remote_refs(
repo_path: &RepoPath,
remote: Option<&str>,
url: &str,
basic_credential: Option<crate::sync::cred::BasicAuthCredential>,
) -> Result<HashMap<String, Oid>> {
let repo = repo(repo_path)?;
let mut remote_handle = if let Some(name) = remote {
Expand All @@ -56,7 +57,7 @@ pub fn advertised_remote_refs(
repo.remote_anonymous(url)?
};

let callbacks = Callbacks::new(None, None);
let callbacks = Callbacks::new(None, basic_credential);
let conn = remote_handle.connect_auth(
Direction::Push,
Some(callbacks.callbacks()),
Expand Down Expand Up @@ -146,6 +147,7 @@ pub fn hooks_pre_push(
remote: Option<&str>,
url: &str,
push: &PrePushTarget<'_>,
basic_credential: Option<crate::sync::cred::BasicAuthCredential>,
) -> Result<HookResult> {
scope_time!("hooks_pre_push");

Expand All @@ -158,7 +160,12 @@ pub fn hooks_pre_push(
return Ok(HookResult::Ok);
}

let advertised = advertised_remote_refs(repo_path, remote, url)?;
let advertised = advertised_remote_refs(
repo_path,
remote,
url,
basic_credential,
)?;
let updates = match push {
PrePushTarget::Branch { branch, delete } => {
let remote_ref = branch_push_destination_ref(
Expand Down
2 changes: 1 addition & 1 deletion asyncgit/src/sync/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ pub use git2::BranchType;
pub use hooks::{
advertised_remote_refs, hooks_commit_msg, hooks_post_commit,
hooks_pre_commit, hooks_pre_push, hooks_prepare_commit_msg,
HookResult, PrePushRef, PrePushTarget, PrepareCommitMsgSource,
HookResult, PrePushTarget, PrepareCommitMsgSource,
};
pub use hunks::{reset_hunk, stage_hunk, unstage_hunk};
pub use ignore::add_to_ignore;
Expand Down
1 change: 1 addition & 0 deletions src/popups/push.rs
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,7 @@ impl PushPopup {
branch: &self.branch,
delete: self.modifier.delete(),
},
cred.clone(),
)? {
log::error!("pre-push hook failed: {e}");
self.queue.push(InternalEvent::ShowErrorMsg(format!(
Expand Down
1 change: 1 addition & 0 deletions src/popups/push_tags.rs
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ impl PushTagsPopup {
Some(&remote),
&remote_url,
&asyncgit::sync::PrePushTarget::Tags,
cred.clone(),
)? {
log::error!("pre-push hook failed: {e}");
self.queue.push(InternalEvent::ShowErrorMsg(format!(
Expand Down