View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0000191 | file | General | public | 2020-08-26 13:37 | 2020-09-09 23:22 |
Reporter | vinc17 | Assigned To | christos | ||
Priority | normal | Severity | feature | Reproducibility | N/A |
Status | assigned | Resolution | open | ||
Summary | 0000191: differentiate git commits and git commit logs | ||||
Description | A file starting with "commit " followed by a hash can be one of the various kinds of Git files. In particular, it can be: 1. a single commit with diff output, e.g. what "git show" outputs; 2. a git commit log, e.g. what "git log" outputs (there may also be various kinds of stats, such as with --stat); 3. a git commit log with diff output, e.g. what "git log --patch" outputs. (1) and (2) are common. (3), which consists of a sequence of commits like in (2), but each one (except merge commits) with a diff like in (1), is possible, but I think that I've never seen it in practice. For all of them, "file" outputs a description of the form "Git commit <hash>". This is particularly misleading for commit log files (2) as such files almost always contain several commits (thus several hashes). It should at least differentiate (1) and (2). Differentiating (3) from (1) is possible by reading a sufficient number of bytes, and I think that this is OK as this can be controlled by the end user with option -P (--parameter). In the case the first line has the form "commit <hash>", I suggest to change the tests to output (depending on what one wishes for a single commit with no diff output): 1. If there are no lines starting with "diff ", output "Git commit log". 2. If there is another line of the form "commit <hash>", output "Git commit log with diff output". 3. Otherwise output "Git commit <hash>". or 1. If there isn't another line of the form "commit <hash>", output "Git commit <hash>". 2. If there are no lines starting with "diff ", output "Git commit log". 3. Otherwise output "Git commit log with diff output". where <hash> in the output is the hash obtained in the first line (which is what "file" currently gives). Note: I think that if there is a diff, a "diff " line will occur in the first non-merge commit, so that there is room for optimization. | ||||
Steps To Reproduce | On a git repository, check the output with: $ git show $ git log $ git log --patch | ||||
Tags | No tags attached. | ||||
|
I don't see any such files, can you post some examples? |
|
I have added the 3 cases: 1. single-commit.txt (a single commit with diff output: what "git show" outputs) 2. commit-log.txt (a git commit log: what "git log" outputs) 3. commit-log-with-diff.txt (a git commit log with diff output: what "git log --patch" outputs) commit-log.txt (289 bytes)
commit a29df8dd7d0def28b30f0281344d58093118ca18 Author: Vincent Lefevre <vincent@vinc17.net> Date: 2020-09-10 01:15:03 +0200 added file2 commit 822309b3b8fcac187ec491b25c04bf86a637d755 Author: Vincent Lefevre <vincent@vinc17.net> Date: 2020-09-10 01:13:34 +0200 added file1 commit-log-with-diff.txt (523 bytes)
commit a29df8dd7d0def28b30f0281344d58093118ca18 Author: Vincent Lefevre <vincent@vinc17.net> Date: 2020-09-10 01:15:03 +0200 added file2 diff --git a/file2 b/file2 new file mode 100644 index 0000000..5716ca5 --- /dev/null +++ b/file2 @@ -0,0 +1 @@ +bar commit 822309b3b8fcac187ec491b25c04bf86a637d755 Author: Vincent Lefevre <vincent@vinc17.net> Date: 2020-09-10 01:13:34 +0200 added file1 diff --git a/file1 b/file1 new file mode 100644 index 0000000..257cc56 --- /dev/null +++ b/file1 @@ -0,0 +1 @@ +foo single-commit.txt (261 bytes)
commit a29df8dd7d0def28b30f0281344d58093118ca18 Author: Vincent Lefevre <vincent@vinc17.net> Date: 2020-09-10 01:15:03 +0200 added file2 diff --git a/file2 b/file2 new file mode 100644 index 0000000..5716ca5 --- /dev/null +++ b/file2 @@ -0,0 +1 @@ +bar |
Date Modified | Username | Field | Change |
---|---|---|---|
2020-08-26 13:37 | vinc17 | New Issue | |
2020-09-06 14:53 | christos | Assigned To | => christos |
2020-09-06 14:53 | christos | Status | new => assigned |
2020-09-06 14:54 | christos | Status | assigned => feedback |
2020-09-06 14:54 | christos | Note Added: 0003481 | |
2020-09-09 23:22 | vinc17 | File Added: commit-log.txt | |
2020-09-09 23:22 | vinc17 | File Added: commit-log-with-diff.txt | |
2020-09-09 23:22 | vinc17 | File Added: single-commit.txt | |
2020-09-09 23:22 | vinc17 | Note Added: 0003484 | |
2020-09-09 23:22 | vinc17 | Status | feedback => assigned |