summaryrefslogtreecommitdiff
path: root/blame.c
Commit message (Collapse)AuthorAgeFilesLines
* Merge branch 'js/blame-lib'Junio C Hamano2017-06-051-0/+1863
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The internal logic used in "git blame" has been libified to make it easier to use by cgit. * js/blame-lib: (29 commits) blame: move entry prepend to libgit blame: move scoreboard setup to libgit blame: move scoreboard-related methods to libgit blame: move fake-commit-related methods to libgit blame: move origin-related methods to libgit blame: move core structures to header blame: create entry prepend function blame: create scoreboard setup function blame: create scoreboard init function blame: rework methods that determine 'final' commit blame: wrap blame_sort and compare_blame_final blame: move progress updates to a scoreboard callback blame: make sanity_check use a callback in scoreboard blame: move no_whole_file_rename flag to scoreboard blame: move xdl_opts flags to scoreboard blame: move show_root flag to scoreboard blame: move reverse flag to scoreboard blame: move contents_from to scoreboard blame: move copy/move thresholds to scoreboard blame: move stat counters to scoreboard ...
| * blame: move entry prepend to libgitJeff Smith2017-05-251-0/+16
| | | | | | | | | | Signed-off-by: Jeff Smith <whydoubt@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * blame: move scoreboard setup to libgitJeff Smith2017-05-251-4/+275
| | | | | | | | | | Signed-off-by: Jeff Smith <whydoubt@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * blame: move scoreboard-related methods to libgitJeff Smith2017-05-251-0/+1313
| | | | | | | | | | Signed-off-by: Jeff Smith <whydoubt@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * blame: move fake-commit-related methods to libgitJeff Smith2017-05-251-1/+202
| | | | | | | | | | Signed-off-by: Jeff Smith <whydoubt@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * blame: move origin-related methods to libgitJeff Smith2017-05-251-0/+62
|/ | | | | Signed-off-by: Jeff Smith <whydoubt@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* git-pickaxe: retire pickaxeJunio C Hamano2006-11-081-1089/+0
| | | | | | | | | Just make it take over blame's place. Documentation and command have all stopped mentioning "git-pickaxe". The built-in synonym is left in the command table, so you can still say "git pickaxe", but it probably is a good idea to retire it as well. Signed-off-by: Junio C Hamano <junkio@cox.net>
* Merge branch 'jc/pickaxe'Junio C Hamano2006-11-071-0/+3
|\
| * git-blame: add internal statistics to count read blobs.Junio C Hamano2006-11-051-0/+3
| |
* | Merge branch 'maint'Junio C Hamano2006-10-301-0/+5
|\ \ | | | | | | | | | | | | | | | | | | | | | | | | * maint: revision traversal: --unpacked does not limit commit list anymore. Continue traversal when rev-list --unpacked finds a packed commit. Use memmove instead of memcpy for overlapping areas quote.c: ensure the same quoting across platforms. Surround "#define DEBUG 0" with "#ifndef DEBUG..#endif"
| * | Surround "#define DEBUG 0" with "#ifndef DEBUG..#endif"Junio C Hamano2006-10-301-0/+5
| |/ | | | | | | | | | | Otherwise "make CFLAGS=-DDEBUG=1" is cumbersome to run. Signed-off-by: Junio C Hamano <junkio@cox.net>
* | blame: Document and add help text for -f, -n, and -pJunio C Hamano2006-10-121-3/+7
| | | | | | | | | | | | | | | | New options --show-name, --show-number and --porcelain were not documented. Also add -p as a short-hand for --porcelain for consistency. Signed-off-by: Junio C Hamano <junkio@cox.net>
* | git-blame --porcelainJunio C Hamano2006-10-061-22/+127
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The new option makes the command's native output format to emit output that is easier to handle by Porcelain. Each line is output after a header. The header at the minimum has the first line which has: - 40-byte SHA-1 of the commit the line is attributed to; - the line number of the line in the original file; - the line number of the line in the final file; - on a line that starts a group of line from a different commit than the previous one, the number of lines in this group. On subsequent lines this field is absent. This header line is followed by the following information once for each commit: - author name ("author"), email ("author-mail"), time ("author-time"), and timezone ("author-tz"); similarly for committer. - filename in the commit the line is attributed to. - the first line of the commit log message ("summary"). The contents of the actual line is output after the above header, prefixed by a TAB. This is to allow adding more header elements later. Signed-off-by: Junio C Hamano <junkio@cox.net>
* | blame.c: move code to output metainfo into a separate function.Junio C Hamano2006-10-051-31/+45
| | | | | | | | | | | | | | | | This does not change any behaviour, but just separates out the code to emit the initial part of the output of each line into a separate function, since I'll be mucking with it further. Signed-off-by: Junio C Hamano <junkio@cox.net>
* | git-blame: --show-number (and -n)Junio C Hamano2006-10-051-4/+38
| | | | | | | | | | | | | | | | | | | | | | | | | | The new option makes the command's native output format show the original line number in the blamed revision. Note: the current implementation of find_orig_linenum involves linear search through the line_map array every time. It should probably build a reverse map upfront and do a simple look-up to speed things up, but I'll leave it to more clever and beautiful people ;-). Signed-off-by: Junio C Hamano <junkio@cox.net>
* | git-blame: --show-name (and -f)Junio C Hamano2006-10-051-5/+9
| | | | | | | | | | | | | | | | The new option makes the command's native output format show the filename even when there were no renames in its history, to make it simpler for Porcelains to parse its output. Signed-off-by: Junio C Hamano <junkio@cox.net>
* | blame.c: whitespace and formatting clean-up.Junio C Hamano2006-10-051-100/+100
|/ | | | Signed-off-by: Junio C Hamano <junkio@cox.net>
* Replace uses of strdup with xstrdup.Shawn Pearce2006-09-021-1/+1
| | | | | | | | | | | | | | | | Like xmalloc and xrealloc xstrdup dies with a useful message if the native strdup() implementation returns NULL rather than a valid pointer. I just tried to use xstrdup in new code and found it to be missing. However I expected it to be present as xmalloc and xrealloc are already commonly used throughout the code. [jc: removed the part that deals with last_XXX, which I am finding more and more dubious these days.] Signed-off-by: Shawn O. Pearce <spearce@spearce.org> Signed-off-by: Junio C Hamano <junkio@cox.net>
* Convert memset(hash,0,20) to hashclr(hash).Junio C Hamano2006-08-231-1/+1
| | | | | | In the same spirit as hashcmp() and hashcpy(). Signed-off-by: Junio C Hamano <junkio@cox.net>
* Convert memcpy(a,b,20) to hashcpy(a,b).Shawn Pearce2006-08-231-2/+2
| | | | | | | | | | | | | | | | | | | | | | | This abstracts away the size of the hash values when copying them from memory location to memory location, much as the introduction of hashcmp abstracted away hash value comparsion. A few call sites were using char* rather than unsigned char* so I added the cast rather than open hashcpy to be void*. This is a reasonable tradeoff as most call sites already use unsigned char* and the existing hashcmp is also declared to be unsigned char*. [jc: Splitted the patch to "master" part, to be followed by a patch for merge-recursive.c which is not in "master" yet. Fixed the cast in the latter hunk to combine-diff.c which was wrong in the original. Also converted ones left-over in combine-diff.c, diff-lib.c and upload-pack.c ] Signed-off-by: Shawn O. Pearce <spearce@spearce.org> Signed-off-by: Junio C Hamano <junkio@cox.net>
* remove unnecessary initializationsDavid Rientjes2006-08-151-3/+3
| | | | | | | | [jc: I needed to hand merge the changes to the updated codebase, so the result needs to be checked.] Signed-off-by: David Rientjes <rientjes@google.com> Signed-off-by: Junio C Hamano <junkio@cox.net>
* blame.c return cleanupDavid Rientjes2006-08-141-4/+1
| | | | | | | Removes conditional from return Signed-off-by: David Rientjes <rientjes@google.com> Signed-off-by: Junio C Hamano <junkio@cox.net>
* Fixup command names in some usage strings.Ramsay Allan Jones2006-08-031-1/+1
| | | | | | | | | Most usage strings, such as for command xxx, start with "git-xxx". This updates the rebels to conform to the general pattern. (The git wrapper is an exception to this, of course ...) Signed-off-by: Ramsay Allan Jones <ramsay@ramsay1.demon.co.uk> Signed-off-by: Junio C Hamano <junkio@cox.net>
* Call setup_git_directory() earlyLinus Torvalds2006-07-281-1/+1
| | | | | | | | | | | | | | | Any git command that expects to work in a subdirectory of a project, and that reads the git config files (which is just about all of them) needs to make sure that it does the "setup_git_directory()" call before it tries to read the config file. This means, among other things, that we need to move the call out of "init_revisions()", and into the caller. This does the mostly trivial conversion to do that. Signed-off-by: Linus Torvalds <torvalds@osdl.org> Signed-off-by: Junio C Hamano <junkio@cox.net>
* Avoid C99 comments, use old-style C comments instead.Pavel Roskin2006-07-101-3/+3
| | | | | | | | | | This doesn't make the code uglier or harder to read, yet it makes the code more portable. This also simplifies checking for other potential incompatibilities. "gcc -std=c89 -pedantic" can flag many incompatible constructs as warnings, but C99 comments will cause it to emit an error. Signed-off-by: Pavel Roskin <proski@gnu.org> Signed-off-by: Junio C Hamano <junkio@cox.net>
* Fix more typos, primarily in the codePavel Roskin2006-07-101-10/+10
| | | | | | | | | The only visible change is that git-blame doesn't understand "--compability" anymore, but it does accept "--compatibility" instead, which is already documented. Signed-off-by: Pavel Roskin <proski@gnu.org> Signed-off-by: Junio C Hamano <junkio@cox.net>
* Cast pointers to `void *' when used in a format.Florian Forster2006-06-181-2/+2
| | | | | | | | ANSI C99 requires void-pointers when using the `%p' format. This patch adds the neccessary cast in `blame.c'. Signed-off-by: Florian Forster <octo@verplant.org> Signed-off-by: Junio C Hamano <junkio@cox.net>
* Move "void *util" from "struct object" into "struct commit"Linus Torvalds2006-06-171-24/+24
| | | | | | | | | | | | | | | | | Every single user actually wanted this only for commit objects, and we have no reason to waste space on it for other object types. So just move the structure member from the low-level "struct object" into the "struct commit". This leaves the commit object the same size, and removes one unnecessary pointer from all other object allocations. This shrinks memory usage (still at a fairly hefty half-gig, admittedly) of "git-rev-list --all --objects" on the mozilla repo by another 5% in my tests. Signed-off-by: Linus Torvalds <torvalds@osdl.org> Signed-off-by: Junio C Hamano <junkio@cox.net>
* blame: Add --time to produce raw timestampsFredrik Kuivinen2006-06-161-4/+20
| | | | | | | fix the usage string and clean up the docs while we are at it Signed-off-by: Fredrik Kuivinen <freku045@student.liu.se> Signed-off-by: Junio C Hamano <junkio@cox.net>
* Make "tree_entry" have a SHA1 instead of a union of object pointersLinus Torvalds2006-05-291-2/+2
| | | | | | | | This is preparatory work for further cleanups, where we try to make tree_entry look more like the more efficient tree-walk descriptor. Signed-off-by: Linus Torvalds <torvalds@osdl.org> Signed-off-by: Junio C Hamano <junkio@cox.net>
* blame: Fix path pruningFredrik Kuivinen2006-05-031-5/+5
| | | | | | | | This makes git-blame useable again, it has been totally broken for some time on larger repositories. Signed-off-by: Fredrik Kuivinen <freku045@student.liu.se> Signed-off-by: Junio C Hamano <junkio@cox.net>
* blame and friends: adjust to multiple pathspec change.Junio C Hamano2006-04-101-6/+14
| | | | | | | | | | | This makes things that include revision.h build again. Blame is also built, but I am not sure how well it works (or how well it worked to begin with) -- it was relying on tree-diff to be using whatever pathspec was used the last time, which smells a bit suspicious. Signed-off-by: Junio C Hamano <junkio@cox.net>
* Merge branch 'jc/blame' into nextJunio C Hamano2006-04-071-5/+37
|\ | | | | | | | | | | * jc/blame: blame -S <ancestry-file> Match ofs/cnt types in diff interface.
| * blame -S <ancestry-file>Junio C Hamano2006-04-071-5/+37
| | | | | | | | | | | | | | This adds the -S <ancestry-file> option to blame, which is needed by the CVS server emulation. Signed-off-by: Junio C Hamano <junkio@cox.net>
* | Merge branch 'master' into nextJunio C Hamano2006-04-051-0/+1
|\ \ | |/ |/| | | | | * master: blame.c: fix completely broken ancestry traversal.
| * blame.c: fix completely broken ancestry traversal.Junio C Hamano2006-04-051-0/+1
| | | | | | | | | | | | | | | | Recent revision.c updates completely broken the assignment of blames by not rewriting commit->parents field unless explicitly asked to by the caller. The caller needs to set revs.parents. Signed-off-by: Junio C Hamano <junkio@cox.net>
* | blame: use built-in xdiffJunio C Hamano2006-04-051-93/+67
|/ | | | | | | | This removes the last use of external diff from core git suite. Also addresses the use of index() -- elsewhere we tend to use strchr(). Signed-off-by: Junio C Hamano <junkio@cox.net>
* Use blob_, commit_, tag_, and tree_type throughout.Peter Eriksen2006-04-041-1/+1
| | | | | | | | | This replaces occurences of "blob", "commit", "tag", and "tree", where they're really used as type specifiers, which we already have defined global constants for. Signed-off-by: Peter Eriksen <s022018@student.dtu.dk> Signed-off-by: Junio C Hamano <junkio@cox.net>
* Merge branch 'jc/name' into nextJunio C Hamano2006-03-231-0/+1
|\ | | | | | | | | | | * jc/name: sha1_name: make core.warnambiguousrefs the default. sha1_name: warning ambiguous refs.
| * sha1_name: warning ambiguous refs.Junio C Hamano2006-03-231-0/+1
| | | | | | | | | | | | | | | | | | This makes sure that many commands that take refs on the command line to honor core.warnambiguousrefs configuration. Earlier, the commands affected by this patch did not read the configuration file. Signed-off-by: Junio C Hamano <junkio@cox.net>
* | fix field width/precision warnings in blame.cLuck, Tony2006-03-211-1/+1
|/ | | | | | | | Using "size_t" values for printf field width/precision upsets gcc, it wants to see an "int". Signed-off-by: Tony Luck <tony.luck@intel.com> Signed-off-by: Junio C Hamano <junkio@cox.net>
* blame: Fix git-blame <directory>Fredrik Kuivinen2006-03-171-0/+6
| | | | | | | | | Before this patch git-blame <directory> gave non-sensible output. (It assigned blame to some random file in <directory>) Abort with an error message instead. Signed-off-by: Fredrik Kuivinen <freku045@student.liu.se> Signed-off-by: Junio C Hamano <junkio@cox.net>
* blame: Nicer outputFredrik Kuivinen2006-03-171-5/+30
| | | | | | | | | | | | | | As pointed out by Junio, it may be dangerous to cut off people's names after 15 bytes. If the name is encoded in an encoding which uses more than one byte per code point we may end up with outputting garbage. Instead of trying to do something smart, just output the entire name. We don't gain much screen space by chopping it off anyway. Furthermore, only output the file name if we actually found any renames. Signed-off-by: Fredrik Kuivinen <freku045@student.liu.se> Signed-off-by: Junio C Hamano <junkio@cox.net>
* blame: Rename detection (take 2)Fredrik Kuivinen2006-03-101-40/+199
| | | | | Signed-off-by: Fredrik Kuivinen <freku045@student.liu.se> Signed-off-by: Junio C Hamano <junkio@cox.net>
* blame: unbreak "diff -U 0".Junio C Hamano2006-03-061-2/+2
| | | | | | | | | | | | | The commit 604c86d15bb319a1e93ba218fca48ce1c500ae52 changed the original "diff -u0" to "diff -u -U 0" for portability. A big mistake without proper testing. The form "diff -u -U 0" shows the default 3-line contexts, because -u and -U 0 contradicts with each other; "diff -U 0" (or its longhand "diff --unified=0") is what we meant. Signed-off-by: Junio C Hamano <junkio@cox.net>
* blame: avoid "diff -u0".Junio C Hamano2006-03-051-1/+1
| | | | | | As Linus suggests, use "diff -u -U 0" instead. Signed-off-by: Junio C Hamano <junkio@cox.net>
* blame and annotate: show localtime with timezone.Junio C Hamano2006-03-051-4/+13
| | | | | | | Earlier they showed gmtime and timezone, which was inconsistent with the way our commits and tags are pretty-printed. Signed-off-by: Junio C Hamano <junkio@cox.net>
* blame: avoid -lm by not using log().Junio C Hamano2006-03-051-2/+4
| | | | | | ... as suggested on the list. Signed-off-by: Junio C Hamano <junkio@cox.net>
* git-blame: Make the output human readableFredrik Kuivinen2006-03-051-18/+144
| | | | | | | | | The default output mode is slightly different from git-annotate's. However, git-annotate's output mode can be obtained by using the '-c' flag. Signed-off-by: Fredrik Kuivinen <freku045@student.liu.se> Signed-off-by: Junio C Hamano <junkio@cox.net>
* Const tightening.Junio C Hamano2006-03-051-0/+2
| | | | | | | | | Mark Wooding noticed there was a type mismatch warning in git.c; this patch does things slightly differently (mostly tightening const) and was what I was holding onto, waiting for the setup-revisions change to be merged into the master branch. Signed-off-by: Junio C Hamano <junkio@cox.net>