path: root/builtin/mailsplit.c
AgeCommit message (Collapse)Author
2014-10-07mailsplit: remove unnecessary unlink(2) callRené Scharfe
The output file hasn't been created at this point, yet, so there is no need to delete it when exiting early. Suggested-by: Jeff King <> Signed-off-by: Rene Scharfe <> Reviewed-by: Jonathan Nieder <> Signed-off-by: Junio C Hamano <>
2014-08-13mailsplit.c: remove dead codeStefan Beller
This was found by coverity. (Id: 290001) The variable 'output' is assigned to a value after all gotos to the corrupt label. Remove the goto by moving the errorhandling code to the condition, which detects the error. Signed-off-by: Stefan Beller <> Helped-by: René Scharfe <> Signed-off-by: Junio C Hamano <>
2013-03-03mailsplit: sort maildir filenames more cleverlyJeff King
A maildir does not technically record the order in which items were placed into it. That means that when applying a patch series from a maildir, we may get the patches in the wrong order. We try to work around this by sorting the filenames. Unfortunately, this may or may not work depending on the naming scheme used by the writer of the maildir. For instance, mutt will write: ${epoch_seconds}.${pid}_${seq}.${host} where we have: - epoch_seconds: timestamp at which entry was written - pid: PID of writing process - seq: a sequence number to ensure uniqueness of filenames - host: hostname None of the numbers are zero-padded. Therefore, when we sort the names as byte strings, entries that cross a digit boundary (e.g., 10) will sort out of order. In the case of timestamps, it almost never matters (because we do not cross a digit boundary in the epoch time very often these days). But for the sequence number, a 10-patch series would be ordered as 1, 10, 2, 3, etc. To fix this, we can use a custom sort comparison function which traverses each string, comparing chunks of digits numerically, and otherwise doing a byte-for-byte comparison. That would sort: ... according to the sequence number. Since maildir does not define a filename format, this is really just a heuristic. But it happens to work for mutt, and there is a reasonable chance that it will work for other writers, too (at least as well as a straight sort). Signed-off-by: Jeff King <> Signed-off-by: Junio C Hamano <>
2010-10-08Use parentheses and `...' where appropriateŠtěpán Němec
Remove some stray usage of other bracket types and asterisks for the same purpose. Signed-off-by: Štěpán Němec <> Acked-by: Jonathan Nieder <> Signed-off-by: Junio C Hamano <>
2010-07-05string_list: Add STRING_LIST_INIT macro and make use of it.Thiago Farina
Acked-by: Jonathan Nieder <> Signed-off-by: Thiago Farina <> Signed-off-by: Junio C Hamano <>
2010-06-27string_list: Fix argument order for string_list_insertJulian Phillips
Update the definition and callers of string_list_insert to use the string_list as the first argument. This helps make the string_list API easier to use by being more consistent. Signed-off-by: Julian Phillips <> Signed-off-by: Junio C Hamano <>
2010-03-10Merge branch 'sh/am-keep-cr'Junio C Hamano
* sh/am-keep-cr: git-am: Add tests for `--keep-cr`, `--no-keep-cr` and `am.keepcr` git-am: Add am.keepcr and --no-keep-cr to override it git-am: Add command line parameter `--keep-cr` passing it to git-mailsplit documentation: 'git-mailsplit --keep-cr' is not hidden anymore
2010-02-22Move 'builtin-*' into a 'builtin/' subdirectoryLinus Torvalds
This shrinks the top-level directory a bit, and makes it much more pleasant to use auto-completion on the thing. Instead of [torvalds@nehalem git]$ em buil<tab> Display all 180 possibilities? (y or n) [torvalds@nehalem git]$ em builtin-sh builtin-shortlog.c builtin-show-branch.c builtin-show-ref.c builtin-shortlog.o builtin-show-branch.o builtin-show-ref.o [torvalds@nehalem git]$ em builtin-shor<tab> builtin-shortlog.c builtin-shortlog.o [torvalds@nehalem git]$ em builtin-shortlog.c you get [torvalds@nehalem git]$ em buil<tab> [type] builtin/ builtin.h [torvalds@nehalem git]$ em builtin [auto-completes to] [torvalds@nehalem git]$ em builtin/sh<tab> [type] shortlog.c shortlog.o show-branch.c show-branch.o show-ref.c show-ref.o [torvalds@nehalem git]$ em builtin/sho [auto-completes to] [torvalds@nehalem git]$ em builtin/shor<tab> [type] shortlog.c shortlog.o [torvalds@nehalem git]$ em builtin/shortlog.c which doesn't seem all that different, but not having that annoying break in "Display all 180 possibilities?" is quite a relief. NOTE! If you do this in a clean tree (no object files etc), or using an editor that has auto-completion rules that ignores '*.o' files, you won't see that annoying 'Display all 180 possibilities?' message - it will just show the choices instead. I think bash has some cut-off around 100 choices or something. So the reason I see this is that I'm using an odd editory, and thus don't have the rules to cut down on auto-completion. But you can simulate that by using 'ls' instead, or something similar. Signed-off-by: Linus Torvalds <> Signed-off-by: Junio C Hamano <>