Skip to content

Commit 36b7b11

Browse files
committed
fix(email): Send using --branch option
The refspec passed to `git send-email` would use "HEAD" in several circumstances instead of an explicit commit id. This caused problems when the --branch option was used since HEAD refers to the current branch and not the user-specified branch. The repair is to use explicit commit ids in all circumstances. Refs: #182
1 parent 57546dd commit 36b7b11

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

src/cmd/email/send.rs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -403,11 +403,7 @@ pub(super) fn dispatch(matches: &clap::ArgMatches) -> Result<()> {
403403
}
404404
let base = stack.get_patch_commit(&patches[0]).parent_id(0)?;
405405
let last = stack.get_patch_commit(patches.last().unwrap()).id();
406-
if last == stack.branch_head.id() {
407-
vec![format!("{base}..HEAD")]
408-
} else {
409-
vec![format!("{base}..{last}")]
410-
}
406+
vec![format!("{base}..{last}")]
411407
}
412408
} else if matches.get_flag("all") {
413409
let applied = stack.applied();
@@ -421,7 +417,8 @@ pub(super) fn dispatch(matches: &clap::ArgMatches) -> Result<()> {
421417
}
422418
}
423419
let base = stack.base().id();
424-
vec![format!("{base}..HEAD")]
420+
let last = stack.get_patch_commit(applied.last().unwrap()).id();
421+
vec![format!("{base}..{last}")]
425422
} else {
426423
panic!("expect either patchranges or -a/--all")
427424
};

0 commit comments

Comments
 (0)