* [PATCH] remove unnecessary 'if'
From: Alexander Potashev @ 2008-12-10 14:09 UTC (permalink / raw)
To: git; +Cc: gitster, Alexander Potashev
'patch->is_new' is always <= 0 at this point (look at 'assert' at the
beginning of the function). In both cases ('is_new < 0' and 'is_new == 0')
the result of those two lines is zeroing of 'is_new'.
Signed-off-by: Alexander Potashev <aspotashev@gmail.com>
---
builtin-apply.c | 3 +--
1 files changed, 1 insertions(+), 2 deletions(-)
diff --git a/builtin-apply.c b/builtin-apply.c
index 4c4d1e1..904a748 100644
--- a/builtin-apply.c
+++ b/builtin-apply.c
@@ -2440,8 +2440,7 @@ static int check_preimage(struct patch *patch, struct cache_entry **ce, struct s
if (!cached)
st_mode = ce_mode_from_stat(*ce, st->st_mode);
- if (patch->is_new < 0)
- patch->is_new = 0;
+ patch->is_new = 0;
if (!patch->old_mode)
patch->old_mode = st_mode;
if ((st_mode ^ patch->old_mode) & S_IFMT)
--
1.6.0.4
^ permalink raw reply related
* [PATCH] Update Hungarian translation for 0.12
From: Miklos Vajna @ 2008-12-10 14:03 UTC (permalink / raw)
To: Shawn O. Pearce; +Cc: git
In-Reply-To: <20081208163628.GG31551@spearce.org>
Signed-off-by: Miklos Vajna <vmiklos@frugalware.org>
---
po/hu.po | 186 ++++++++++++++++++++++++++++++++------------------------------
1 files changed, 96 insertions(+), 90 deletions(-)
diff --git a/po/hu.po b/po/hu.po
index 8ec4339..f761b64 100644
--- a/po/hu.po
+++ b/po/hu.po
@@ -7,8 +7,8 @@ msgid ""
msgstr ""
"Project-Id-Version: git-gui-i 18n\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2008-11-16 13:56-0800\n"
-"PO-Revision-Date: 2008-11-17 23:03+0100\n"
+"POT-Creation-Date: 2008-12-08 08:31-0800\n"
+"PO-Revision-Date: 2008-12-10 15:00+0100\n"
"Last-Translator: Miklos Vajna <vmiklos@frugalware.org>\n"
"Language-Team: Hungarian\n"
"MIME-Version: 1.0\n"
@@ -241,25 +241,25 @@ msgstr "VisszavonĂĄs"
msgid "Redo"
msgstr "MĂŠgis"
-#: git-gui.sh:2378 git-gui.sh:2923
+#: git-gui.sh:2378 git-gui.sh:2937
msgid "Cut"
msgstr "KivĂĄgĂĄs"
-#: git-gui.sh:2381 git-gui.sh:2926 git-gui.sh:3000 git-gui.sh:3082
+#: git-gui.sh:2381 git-gui.sh:2940 git-gui.sh:3014 git-gui.sh:3096
#: lib/console.tcl:69
msgid "Copy"
msgstr "MĂĄsolĂĄs"
-#: git-gui.sh:2384 git-gui.sh:2929
+#: git-gui.sh:2384 git-gui.sh:2943
msgid "Paste"
msgstr "BeillesztĂŠs"
-#: git-gui.sh:2387 git-gui.sh:2932 lib/branch_delete.tcl:26
+#: git-gui.sh:2387 git-gui.sh:2946 lib/branch_delete.tcl:26
#: lib/remote_branch_delete.tcl:38
msgid "Delete"
msgstr "TĂśrlĂŠs"
-#: git-gui.sh:2391 git-gui.sh:2936 git-gui.sh:3086 lib/console.tcl:71
+#: git-gui.sh:2391 git-gui.sh:2950 git-gui.sh:3100 lib/console.tcl:71
msgid "Select All"
msgstr "Mindent kivĂĄlaszt"
@@ -291,15 +291,15 @@ msgstr "KĂŠsz"
msgid "Commit@@verb"
msgstr "Commit@@ige"
-#: git-gui.sh:2443 git-gui.sh:2864
+#: git-gui.sh:2443 git-gui.sh:2878
msgid "New Commit"
msgstr "Ăj commit"
-#: git-gui.sh:2451 git-gui.sh:2871
+#: git-gui.sh:2451 git-gui.sh:2885
msgid "Amend Last Commit"
msgstr "UtolsĂł commit javĂtĂĄsa"
-#: git-gui.sh:2461 git-gui.sh:2825 lib/remote_branch_delete.tcl:99
+#: git-gui.sh:2461 git-gui.sh:2839 lib/remote_branch_delete.tcl:99
msgid "Rescan"
msgstr "KeresĂŠs Ăşjra"
@@ -319,15 +319,15 @@ msgstr "Commitba valĂł kivĂĄlasztĂĄs visszavonĂĄsa"
msgid "Revert Changes"
msgstr "VĂĄltoztatĂĄsok visszaĂĄllĂtĂĄsa"
-#: git-gui.sh:2491 git-gui.sh:3069
+#: git-gui.sh:2491 git-gui.sh:3083
msgid "Show Less Context"
msgstr "Kevesebb kĂśrnyezet mutatĂĄsa"
-#: git-gui.sh:2495 git-gui.sh:3073
+#: git-gui.sh:2495 git-gui.sh:3087
msgid "Show More Context"
msgstr "TĂśbb kĂśrnyezet mutatĂĄsa"
-#: git-gui.sh:2502 git-gui.sh:2838 git-gui.sh:2947
+#: git-gui.sh:2502 git-gui.sh:2852 git-gui.sh:2961
msgid "Sign Off"
msgstr "AlĂĄĂr"
@@ -361,7 +361,7 @@ msgstr "NĂŠvjegy: %s"
msgid "Preferences..."
msgstr "BeĂĄllĂtĂĄsok..."
-#: git-gui.sh:2565 git-gui.sh:3115
+#: git-gui.sh:2565 git-gui.sh:3129
msgid "Options..."
msgstr "OpciĂłk..."
@@ -381,125 +381,125 @@ msgstr "Online dokumentĂĄciĂł"
msgid "Show SSH Key"
msgstr "SSH kulcs mutatĂĄsa"
-#: git-gui.sh:2707
+#: git-gui.sh:2721
#, tcl-format
msgid "fatal: cannot stat path %s: No such file or directory"
msgstr ""
"vĂŠgzetes hiba: nem ĂŠrhetĹ el a(z) %s Ăştvonal: Nincs ilyen fĂĄjl vagy kĂśnyvtĂĄr"
-#: git-gui.sh:2740
+#: git-gui.sh:2754
msgid "Current Branch:"
msgstr "Jelenlegi branch:"
-#: git-gui.sh:2761
+#: git-gui.sh:2775
msgid "Staged Changes (Will Commit)"
msgstr "KivĂĄlasztott vĂĄltoztatĂĄsok (commitolva lesz)"
-#: git-gui.sh:2781
+#: git-gui.sh:2795
msgid "Unstaged Changes"
msgstr "KivĂĄlasztatlan vĂĄltoztatĂĄsok"
-#: git-gui.sh:2831
+#: git-gui.sh:2845
msgid "Stage Changed"
msgstr "VĂĄltoztatĂĄsok kivĂĄlasztĂĄsa"
-#: git-gui.sh:2850 lib/transport.tcl:93 lib/transport.tcl:182
+#: git-gui.sh:2864 lib/transport.tcl:104 lib/transport.tcl:193
msgid "Push"
msgstr "Push"
-#: git-gui.sh:2885
+#: git-gui.sh:2899
msgid "Initial Commit Message:"
msgstr "Kezdeti commit Ăźzenet:"
-#: git-gui.sh:2886
+#: git-gui.sh:2900
msgid "Amended Commit Message:"
msgstr "JavĂtĂł commit Ăźzenet:"
-#: git-gui.sh:2887
+#: git-gui.sh:2901
msgid "Amended Initial Commit Message:"
msgstr "Kezdeti javĂtĂł commit Ăźzenet:"
-#: git-gui.sh:2888
+#: git-gui.sh:2902
msgid "Amended Merge Commit Message:"
msgstr "JavĂtĂł merge commit Ăźzenet:"
-#: git-gui.sh:2889
+#: git-gui.sh:2903
msgid "Merge Commit Message:"
msgstr "Merge commit Ăźzenet:"
-#: git-gui.sh:2890
+#: git-gui.sh:2904
msgid "Commit Message:"
msgstr "Commit Ăźzenet:"
-#: git-gui.sh:2939 git-gui.sh:3090 lib/console.tcl:73
+#: git-gui.sh:2953 git-gui.sh:3104 lib/console.tcl:73
msgid "Copy All"
msgstr "Ăsszes mĂĄsolĂĄsa"
-#: git-gui.sh:2963 lib/blame.tcl:104
+#: git-gui.sh:2977 lib/blame.tcl:104
msgid "File:"
msgstr "FĂĄjl:"
-#: git-gui.sh:3078
+#: git-gui.sh:3092
msgid "Refresh"
msgstr "FrissĂtĂŠs"
-#: git-gui.sh:3099
+#: git-gui.sh:3113
msgid "Decrease Font Size"
msgstr "Font mĂŠret csĂśkkentĂŠse"
-#: git-gui.sh:3103
+#: git-gui.sh:3117
msgid "Increase Font Size"
msgstr "FĂśnt mĂŠret nĂśvelĂŠse"
-#: git-gui.sh:3111 lib/blame.tcl:281
+#: git-gui.sh:3125 lib/blame.tcl:281
msgid "Encoding"
msgstr "KĂłdolĂĄs"
-#: git-gui.sh:3122
+#: git-gui.sh:3136
msgid "Apply/Reverse Hunk"
msgstr "Hunk alkalmazĂĄsa/visszaĂĄllĂtĂĄsa"
-#: git-gui.sh:3127
+#: git-gui.sh:3141
msgid "Apply/Reverse Line"
msgstr "Sor alkalmazĂĄsa/visszaĂĄllĂtĂĄsa"
-#: git-gui.sh:3137
+#: git-gui.sh:3151
msgid "Run Merge Tool"
msgstr "Merge eszkĂśz futtatĂĄsa"
-#: git-gui.sh:3142
+#: git-gui.sh:3156
msgid "Use Remote Version"
msgstr "TĂĄvoli verziĂł hasznĂĄlata"
-#: git-gui.sh:3146
+#: git-gui.sh:3160
msgid "Use Local Version"
msgstr "Helyi verziĂł hasznĂĄlata"
-#: git-gui.sh:3150
+#: git-gui.sh:3164
msgid "Revert To Base"
msgstr "VisszaĂĄllĂtĂĄs az alaphoz"
-#: git-gui.sh:3169
+#: git-gui.sh:3183
msgid "Unstage Hunk From Commit"
msgstr "Hunk tĂśrlĂŠse commitbĂłl"
-#: git-gui.sh:3170
+#: git-gui.sh:3184
msgid "Unstage Line From Commit"
msgstr "A sor kivĂĄlasztĂĄsĂĄnak tĂśrlĂŠse"
-#: git-gui.sh:3172
+#: git-gui.sh:3186
msgid "Stage Hunk For Commit"
msgstr "Hunk kivĂĄlasztĂĄsa commitba"
-#: git-gui.sh:3173
+#: git-gui.sh:3187
msgid "Stage Line For Commit"
msgstr "Sor kivĂĄlasztĂĄsa commitba"
-#: git-gui.sh:3196
+#: git-gui.sh:3210
msgid "Initializing..."
msgstr "InicializĂĄlĂĄs..."
-#: git-gui.sh:3301
+#: git-gui.sh:3315
#, tcl-format
msgid ""
"Possible environment issues exist.\n"
@@ -516,7 +516,7 @@ msgstr ""
"indĂtott folyamatok ĂĄltal:\n"
"\n"
-#: git-gui.sh:3331
+#: git-gui.sh:3345
msgid ""
"\n"
"This is due to a known issue with the\n"
@@ -526,7 +526,7 @@ msgstr ""
"Ez a Cygwin ĂĄltal terjesztett Tcl binĂĄrisban\n"
"lĂŠvĹ ismert hiba miatt van."
-#: git-gui.sh:3336
+#: git-gui.sh:3350
#, tcl-format
msgid ""
"\n"
@@ -612,43 +612,43 @@ msgstr "FuttatĂĄs mĂĄsolĂĄs-ĂŠrzĂŠkelĂŠsen keresztĂźl..."
msgid "Loading annotation..."
msgstr "Az annotĂĄciĂł betĂśltĂŠse..."
-#: lib/blame.tcl:964
+#: lib/blame.tcl:963
msgid "Author:"
msgstr "SzerzĹ:"
-#: lib/blame.tcl:968
+#: lib/blame.tcl:967
msgid "Committer:"
msgstr "Commiter:"
-#: lib/blame.tcl:973
+#: lib/blame.tcl:972
msgid "Original File:"
msgstr "Eredeti fĂĄjl:"
-#: lib/blame.tcl:1021
+#: lib/blame.tcl:1020
msgid "Cannot find HEAD commit:"
msgstr "Nem talĂĄlhatĂł a HEAD commit:"
-#: lib/blame.tcl:1076
+#: lib/blame.tcl:1075
msgid "Cannot find parent commit:"
msgstr "Nem talĂĄlhatĂł a szĂźlĹ commit:"
-#: lib/blame.tcl:1091
+#: lib/blame.tcl:1090
msgid "Unable to display parent"
msgstr "Nem lehet megjelenĂteni a szĂźlĹt"
-#: lib/blame.tcl:1092 lib/diff.tcl:297
+#: lib/blame.tcl:1091 lib/diff.tcl:297
msgid "Error loading diff:"
msgstr "Hiba a diff betĂśltĂŠse kĂśzben:"
-#: lib/blame.tcl:1232
+#: lib/blame.tcl:1231
msgid "Originally By:"
msgstr "Eredeti szerzĹ:"
-#: lib/blame.tcl:1238
+#: lib/blame.tcl:1237
msgid "In File:"
msgstr "Ebben a fĂĄjlban:"
-#: lib/blame.tcl:1243
+#: lib/blame.tcl:1242
msgid "Copied Or Moved Here By:"
msgstr "Ide mĂĄsolta vagy helyezte:"
@@ -665,7 +665,7 @@ msgstr "Checkout"
#: lib/checkout_op.tcl:544 lib/choose_font.tcl:43 lib/merge.tcl:172
#: lib/option.tcl:125 lib/remote_add.tcl:32 lib/remote_branch_delete.tcl:42
#: lib/tools_dlg.tcl:40 lib/tools_dlg.tcl:204 lib/tools_dlg.tcl:352
-#: lib/transport.tcl:97
+#: lib/transport.tcl:108
msgid "Cancel"
msgstr "MĂŠgsem"
@@ -1317,19 +1317,19 @@ msgstr ""
"A jelenlegi merge mĂŠg nem teljesen fejezĹdĂśtt be. Csak akkor javĂthat egy "
"elĹbbi commitot, hogyha megszakĂtja a jelenlegi merge folyamatot.\n"
-#: lib/commit.tcl:49
+#: lib/commit.tcl:48
msgid "Error loading commit data for amend:"
msgstr "Hiba a javĂtandĂł commit adat betĂśltĂŠse kĂśzben:"
-#: lib/commit.tcl:76
+#: lib/commit.tcl:75
msgid "Unable to obtain your identity:"
msgstr "Nem sikerĂźlt megĂĄllapĂtani az azonosĂtĂłt:"
-#: lib/commit.tcl:81
+#: lib/commit.tcl:80
msgid "Invalid GIT_COMMITTER_IDENT:"
msgstr "ĂrvĂŠnytelen GIT_COMMITTER_IDENT:"
-#: lib/commit.tcl:133
+#: lib/commit.tcl:132
msgid ""
"Last scanned state does not match repository state.\n"
"\n"
@@ -1346,7 +1346,7 @@ msgstr ""
"\n"
"Az ĂşjrakeresĂŠs most automatikusan el fog indulni.\n"
-#: lib/commit.tcl:156
+#: lib/commit.tcl:155
#, tcl-format
msgid ""
"Unmerged files cannot be committed.\n"
@@ -1359,7 +1359,7 @@ msgstr ""
"A(z) %s fĂĄjlban ĂźtkĂśzĂŠsek vannak. Egyszer azokat ki kell javĂtani, majd "
"hozzĂĄ ki kell vĂĄlasztani a fĂĄjlt mielĹtt commitolni lehetne.\n"
-#: lib/commit.tcl:164
+#: lib/commit.tcl:163
#, tcl-format
msgid ""
"Unknown file state %s detected.\n"
@@ -1370,7 +1370,7 @@ msgstr ""
"\n"
"A(z) %s fĂĄjlt nem tudja ez a program commitolni.\n"
-#: lib/commit.tcl:172
+#: lib/commit.tcl:171
msgid ""
"No changes to commit.\n"
"\n"
@@ -1380,7 +1380,7 @@ msgstr ""
"\n"
"LegalĂĄbb egy fĂĄjl ki kell vĂĄlasztani, hogy commitolni lehessen.\n"
-#: lib/commit.tcl:187
+#: lib/commit.tcl:186
msgid ""
"Please supply a commit message.\n"
"\n"
@@ -1398,45 +1398,45 @@ msgstr ""
"- MĂĄsodik sor: Ăres\n"
"- A tĂśbbi sor: LeĂrja, hogy miĂŠrt jĂł ez a vĂĄltoztatĂĄs.\n"
-#: lib/commit.tcl:211
+#: lib/commit.tcl:210
#, tcl-format
msgid "warning: Tcl does not support encoding '%s'."
msgstr "figyelmeztetĂŠs: a Tcl nem tĂĄmogatja a(z) '%s' kĂłdolĂĄst."
-#: lib/commit.tcl:227
+#: lib/commit.tcl:226
msgid "Calling pre-commit hook..."
msgstr "A pre-commit hurok meghĂvĂĄsa..."
-#: lib/commit.tcl:242
+#: lib/commit.tcl:241
msgid "Commit declined by pre-commit hook."
msgstr "A commitot megakadĂĄlyozta a pre-commit hurok. "
-#: lib/commit.tcl:265
+#: lib/commit.tcl:264
msgid "Calling commit-msg hook..."
msgstr "A commit-msg hurok meghĂvĂĄsa..."
-#: lib/commit.tcl:280
+#: lib/commit.tcl:279
msgid "Commit declined by commit-msg hook."
msgstr "A commiot megakadĂĄlyozta a commit-msg hurok."
-#: lib/commit.tcl:293
+#: lib/commit.tcl:292
msgid "Committing changes..."
msgstr "A vĂĄltoztatĂĄsok commitolĂĄsa..."
-#: lib/commit.tcl:309
+#: lib/commit.tcl:308
msgid "write-tree failed:"
msgstr "a write-tree sikertelen:"
-#: lib/commit.tcl:310 lib/commit.tcl:354 lib/commit.tcl:374
+#: lib/commit.tcl:309 lib/commit.tcl:353 lib/commit.tcl:373
msgid "Commit failed."
msgstr "A commit nem sikerĂźlt."
-#: lib/commit.tcl:327
+#: lib/commit.tcl:326
#, tcl-format
msgid "Commit %s appears to be corrupt"
msgstr "A(z) %s commit sĂŠrĂźltnek tĹąnik"
-#: lib/commit.tcl:332
+#: lib/commit.tcl:331
msgid ""
"No changes to commit.\n"
"\n"
@@ -1450,19 +1450,19 @@ msgstr ""
"\n"
"Az ĂşjrakeresĂŠs most automatikusan el fog indulni.\n"
-#: lib/commit.tcl:339
+#: lib/commit.tcl:338
msgid "No changes to commit."
msgstr "Nincs commitolandĂł vĂĄltoztatĂĄs."
-#: lib/commit.tcl:353
+#: lib/commit.tcl:352
msgid "commit-tree failed:"
msgstr "a commit-tree sikertelen:"
-#: lib/commit.tcl:373
+#: lib/commit.tcl:372
msgid "update-ref failed:"
msgstr "az update-ref sikertelen:"
-#: lib/commit.tcl:461
+#: lib/commit.tcl:460
#, tcl-format
msgid "Created commit %s: %s"
msgstr "LĂŠtrejĂśtt a %s commit: %s"
@@ -2168,7 +2168,8 @@ msgstr "A(z) %s letĂśltĂŠse"
msgid "Do not know how to initialize repository at location '%s'."
msgstr "Nem tudni, hogy hogy kell a(z) '%s' helyen repĂłt inicializĂĄlni."
-#: lib/remote_add.tcl:163 lib/transport.tcl:25 lib/transport.tcl:71
+#: lib/remote_add.tcl:163 lib/transport.tcl:25 lib/transport.tcl:63
+#: lib/transport.tcl:81
#, tcl-format
msgid "push %s"
msgstr "%s push-olĂĄsa"
@@ -2186,11 +2187,11 @@ msgstr "TĂĄvoli Branch tĂśrlĂŠse"
msgid "From Repository"
msgstr "ForrĂĄs repĂł"
-#: lib/remote_branch_delete.tcl:50 lib/transport.tcl:123
+#: lib/remote_branch_delete.tcl:50 lib/transport.tcl:134
msgid "Remote:"
msgstr "TĂĄvoli:"
-#: lib/remote_branch_delete.tcl:66 lib/transport.tcl:138
+#: lib/remote_branch_delete.tcl:66 lib/transport.tcl:149
msgid "Arbitrary Location:"
msgstr "ĂnkĂŠnyes hely:"
@@ -2519,38 +2520,43 @@ msgstr "A %s repĂłbĂłl tĂśrĂślt kĂśvetĹ branchek tĂśrlĂŠse"
msgid "Pushing changes to %s"
msgstr "VĂĄltozĂĄsok pusholĂĄsa ide: %s"
-#: lib/transport.tcl:72
+#: lib/transport.tcl:64
+#, tcl-format
+msgid "Mirroring to %s"
+msgstr "TĂźkrĂśzĂŠs a kĂśvetkezĹ helyre: %s"
+
+#: lib/transport.tcl:82
#, tcl-format
msgid "Pushing %s %s to %s"
msgstr "PusholĂĄs: %s %s, ide: %s"
-#: lib/transport.tcl:89
+#: lib/transport.tcl:100
msgid "Push Branches"
msgstr "Branchek pusholĂĄsa"
-#: lib/transport.tcl:103
+#: lib/transport.tcl:114
msgid "Source Branches"
msgstr "ForrĂĄs branchek"
-#: lib/transport.tcl:120
+#: lib/transport.tcl:131
msgid "Destination Repository"
msgstr "CĂŠl repĂł"
-#: lib/transport.tcl:158
+#: lib/transport.tcl:169
msgid "Transfer Options"
msgstr "Ătviteli opciĂłk"
-#: lib/transport.tcl:160
+#: lib/transport.tcl:171
msgid "Force overwrite existing branch (may discard changes)"
msgstr ""
"LĂŠtezĹ branch felĂźlĂrĂĄsĂĄnak erĹltetĂŠse (lehet, hogy el fog dobni "
"vĂĄltoztatĂĄsokat)"
-#: lib/transport.tcl:164
+#: lib/transport.tcl:175
msgid "Use thin pack (for slow network connections)"
msgstr "VĂŠkony csomagok hasznĂĄlata (lassĂş hĂĄlĂłzati kapcsolatok szĂĄmĂĄra)"
-#: lib/transport.tcl:168
+#: lib/transport.tcl:179
msgid "Include tags"
msgstr "Tageket is"
--
1.6.0.3
^ permalink raw reply related
* Annotating patches inside diff
From: Jakub Narebski @ 2008-12-10 13:45 UTC (permalink / raw)
To: git
I remember that long time ago on git mailing list there was discussed
extending git-apply and friends (including git-am), to be able to
ignore lines in patches with selected special prefix, different from
'@' for chunks headers, ' ' for context, '+'/'-' for added/deleted
lines. IIRC it was chose '|' for this purpose.
This way you could annotate patch
@@ -4667,7 +4667,6 @@ HTML
hash_base => $parent_commit);
print "<td class=\"linenr\">";
print $cgi->a({ -href => "$blamed#l$orig_lineno",
| moved to <tr>
- -id => "l$lineno",
-class => "linenr" },
esc_html($lineno));
print "</td>";
Was it accepted or dropped, or is this feature present but not
documented?
--
Jakub Narebski
Poland
^ permalink raw reply
* builtin-add.c patch
From: daly @ 2008-12-10 12:38 UTC (permalink / raw)
To: git; +Cc: daly
A trivial patch to fix a typo -- Tim Daly
diff --git a/builtin-add.c b/builtin-add.c
index ea4e771..5f2e68b 100644
--- a/builtin-add.c
+++ b/builtin-add.c
@@ -23,7 +23,7 @@ static void fill_pathspec_matches(const char **pathspec, char *seen, int specs)
int num_unmatched = 0, i;
/*
- * Since we are walking the index as if we are warlking the directory,
+ * Since we are walking the index as if we are walking the directory,
* we have to mark the matched pathspec as seen; otherwise we will
* mistakenly think that the user gave a pathspec that did not match
* anything.
^ permalink raw reply related
* Re: [PATCH 2/3] gitweb: Cache $parent_commit info in git_blame()
From: Jakub Narebski @ 2008-12-10 13:39 UTC (permalink / raw)
To: Nanako Shiraishi; +Cc: git, Luben Tuikov
In-Reply-To: <20081210124901.6117@nanako3.lavabit.com>
On Wed, 10 Dec 2008, Nanako Shiraishi wrote:
> Quoting Jakub Narebski <jnareb@gmail.com>:
>
> > Unfortunately the implementation in 244a70e used one call for
> > git-rev-parse to find parent revision per line in file, instead of
> > using long lived "git cat-file --batch-check" (which might not existed
> > then), or changing validate_refname to validate_revision and made it
> > accept <rev>^, <rev>^^, <rev>^^^ etc. syntax.
>
> Could you substantiate why this is "Unfortunate"?
Because it calls git-rev-parse once for _each line_, even if for lines
in the group of neighbour lines blamed by same commit $parent_commit
is the same, and even if you need to calculate $parent_commit only once
per unique individual commit present in blame output.
> Is the new implementation faster? By how much?
File | L[1] | C[2] || Time0[3] | Before[4] | After[4]
====================================================================
blob.h | 18 | 4 || 0m1.727s | 0m2.545s | 0m2.474s
GIT-VERSION-GEN | 42 | 13 || 0m2.165s | 0m2.448s | 0m2.071s
README | 46 | 6 || 0m1.593s | 0m2.727s | 0m2.242s
revision.c | 1923 | 121 || 0m2.357s | 0m30.365s | 0m7.028s
gitweb/gitweb.perl | 6291 | 428 || 0m8.080s | 1m37.244s | 0m20.627s
File | L/C | Before/After
=========================================
blob.h | 4.5 | 1.03
GIT-VERSION-GEN | 3.2 | 1.18
README | 7.7 | 1.22
revision.c | 15.9 | 4.32
gitweb/gitweb.perl | 14.7 | 4.71
As you can see the greater ratio of lines in file to unique commits
in blame output, the greater gain from the new implementation.
Footnotes:
~~~~~~~~~~
[1] Lines:
$ wc -l <file>
[2] Individual commits in blame output:
$ git blame -p <file> | grep author-time | wc -l
[3] Time for running "git blame -p" (user time, single run):
$ time git blame -p <file> >/dev/null
[4] Time to run gitweb as Perl script from command line:
$ gitweb-run.sh "p=git.git;a=blame;f=<file>" > /dev/null 2>&1
Appendix A:
~~~~~~~~~~~
#!/bin/bash
export GATEWAY_INTERFACE="CGI/1.1"
export HTTP_ACCEPT="*/*"
export REQUEST_METHOD="GET"
export QUERY_STRING=""$1""
export PATH_INFO=""$2""
export GITWEB_CONFIG="/home/jnareb/git/gitweb/gitweb_config.perl"
perl -- /home/jnareb/git/gitweb/gitweb.perl
# end of gitweb-run.sh
> When "previous" commit information is available in the output from
> "git blame", can you make use of it?
Yes, I could; but I don't think it got implemented.
--
Jakub Narebski
Poland
^ permalink raw reply
* Re: Unneeded branch history
From: Santi Béjar @ 2008-12-10 12:43 UTC (permalink / raw)
To: Luca Siciliano Viglieri; +Cc: git
In-Reply-To: <50628.127.0.0.1.1228907607.squirrel@localhost>
2008/12/10 Luca Siciliano Viglieri <Luca.Siciliano@bittwister.com>:
> Hi,
> i have tried to find a solution to my problem, but i couldn't find
> anything on the documentation.
> I have created from master branch a development branch. I keep the master
> branch regularly uptodate from the server and in the development branch i
> commit my code. When i merge the two branches i obtain a commit with two
> parents and when i push my master branch to the server, all my development
> history it is also saved in the server.
> Can i avoid saving my develoment history, at least on the server, so that
> the master branch has only one parent commits?
$ git merge --squash
or
$ git rebase -i master
and squash/edit/... some of the revisions (this way you can have the
interesting development history)
HTH,
Santi
^ permalink raw reply
* Unneeded branch history
From: Luca Siciliano Viglieri @ 2008-12-10 11:13 UTC (permalink / raw)
To: git
Hi,
i have tried to find a solution to my problem, but i couldn't find
anything on the documentation.
I have created from master branch a development branch. I keep the master
branch regularly uptodate from the server and in the development branch i
commit my code. When i merge the two branches i obtain a commit with two
parents and when i push my master branch to the server, all my development
history it is also saved in the server.
Can i avoid saving my develoment history, at least on the server, so that
the master branch has only one parent commits?
Thanks
Luca Siciliano
^ permalink raw reply
* Re: Recovering from epic fail (deleted .git/objects/pack)
From: Johannes Sixt @ 2008-12-10 11:39 UTC (permalink / raw)
To: R. Tyler Ballance; +Cc: Junio C Hamano, git
In-Reply-To: <1228903606.4445.53.camel@starfruit.local>
R. Tyler Ballance schrieb:
> On Tue, 2008-12-09 at 16:19 -0800, Junio C Hamano wrote:
>> See if "fsck --full" complains after that. If the repository was not
>> repacked during that period, all objects created by the activity by the
>> unfortunate developer would be loose, so ...
>
> tyler@ccnet:~/source/slide/brian_main> time git fsck --full
> Segmentation fault
Please make a backup (tarball) of the repository that shows this segfault.
'git fsck' is not supposed to segfault, no matter what garbage is thrown
at it.
Can you make a backtrace of this failing 'git fsck --full' invocation?
-- Hannes
^ permalink raw reply
* Re: Recovering from epic fail (deleted .git/objects/pack)
From: R. Tyler Ballance @ 2008-12-10 10:06 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git
In-Reply-To: <7vd4g051ax.fsf@gitster.siamese.dyndns.org>
[-- Attachment #1: Type: text/plain, Size: 1517 bytes --]
On Tue, 2008-12-09 at 16:19 -0800, Junio C Hamano wrote:
> I do not know about "feasible" and "properly", but ...
>
> (0) take backup of the repository of this unfortunate developer.
>
> (1) make a fresh clone of the central repository that this unfortunate
> developer's work started out from.
>
> (2) copy the contents of the .git/objects/pack/ of that clone to the
> developer's .git/objects/pack/.
This approach "sort of" worked, i.e. it worked insofar that I was able
to use the repository enough to generate a series of patch files for the
developer's work from the last two weeks to be applied to their new
clone of the central repository. Why I did this is answered below ;)
>
> See if "fsck --full" complains after that. If the repository was not
> repacked during that period, all objects created by the activity by the
> unfortunate developer would be loose, so ...
tyler@ccnet:~/source/slide/brian_main> time git fsck --full
Segmentation fault
real 27m2.187s
user 10m3.238s
sys 0m16.609s
tyler@ccnet:~/source/slide/brian_main>
Oh well, your approach worked *enough* to get the important data out,
and that's what's most important.
Moving forward we're likely going to implement an automated process of
walking through developers' repositories and pushing any unpushed refs
to a backup repository just to make sure something like this doesn't
happen again.
Appreciate the help :)
Cheers
--
-R. Tyler Ballance
Slide, Inc.
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 197 bytes --]
^ permalink raw reply
* Re: [PATCH] make sure packs to be replaced are closed beforehand
From: Alex Riesen @ 2008-12-10 9:36 UTC (permalink / raw)
To: Johannes Sixt; +Cc: Nicolas Pitre, Junio C Hamano, Git Mailing List
In-Reply-To: <493F71B7.60804@viscovery.net>
2008/12/10 Johannes Sixt <j.sixt@viscovery.net>:
> Nicolas Pitre schrieb:
>> Especially on Windows where an opened file cannot be replaced, make
>> sure pack-objects always close packs it is about to replace. Even on
>> non Windows systems, this could save potential bad results if ever
>> objects were to be read from the new pack file using offset from the old
>> index.
>>
>> This should fix t5303 on Windows.
> ...
>> OK, here it is at last. Please confirm it works on Windows before Junio
>> merges it.
>
> I can confirm that this patch fixes t5303 on Windows (MinGW).
>
And it does that for me, FWIW.
^ permalink raw reply
* [PATCH] rebase: improve error messages about dirty state
From: Jeff King @ 2008-12-10 9:25 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git
If you have unstaged changes in your working tree and try to
rebase, you will get the cryptic "foo: needs update"
message, but nothing else. If you have staged changes, you
get "your index is not up-to-date".
Let's improve this situation in two ways:
- for unstaged changes, let's also tell them we are
canceling the rebase, and why (in addition to the "needs
update" lines)
- for the staged changes case, let's use language that is a
little more clear to the user: their index contains
uncommitted changes
Signed-off-by: Jeff King <peff@peff.net>
---
I am cleaning up some old branches, and I think this is worth applying.
It came out of a "rebase's error message is confusing" thread back in
April:
http://thread.gmane.org/gmane.comp.version-control.git/78698
It would be nice also to say "foo: locally modified" instead of "foo:
needs update" but the REFRESH_SAY_CHANGED functionality isn't exposed
via the command line.
git-rebase.sh | 9 ++++++---
1 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/git-rebase.sh b/git-rebase.sh
index ea7720d..ebd4df3 100755
--- a/git-rebase.sh
+++ b/git-rebase.sh
@@ -332,11 +332,14 @@ else
fi
# The tree must be really really clean.
-git update-index --ignore-submodules --refresh || exit
+if ! git update-index --ignore-submodules --refresh; then
+ echo >&2 "cannot rebase: you have unstaged changes"
+ exit 1
+fi
diff=$(git diff-index --cached --name-status -r --ignore-submodules HEAD --)
case "$diff" in
-?*) echo "cannot rebase: your index is not up-to-date"
- echo "$diff"
+?*) echo >&2 "cannot rebase: your index contains uncommitted changes"
+ echo >&2 "$diff"
exit 1
;;
esac
--
1.6.1.rc2.15.g7752a
^ permalink raw reply related
* Re: [PATCH 1/2] diff: fix handling of binary rewrite diffs
From: Jeff King @ 2008-12-10 9:04 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git
In-Reply-To: <7vvdts1l92.fsf@gitster.siamese.dyndns.org>
On Wed, Dec 10, 2008 at 12:34:49AM -0800, Junio C Hamano wrote:
> > + for j in 1 2 3 4 5 6 7 9 10; do
> Hmm... "1 2 3 4 5 6 7 9 10"?
Heh. Oops.
I see you fixed this up as 1 through 9. My intent was 1 through 10, but
it really doesn't matter. The point is just to hit the minimum break
size, and I left a lot of leeway in case it ever gets increased later.
-Peff
^ permalink raw reply
* Re: [PATCH 2/2] diff: respect textconv in rewrite diffs
From: Jeff King @ 2008-12-10 9:02 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git
In-Reply-To: <7v3agw2zu5.fsf@gitster.siamese.dyndns.org>
On Wed, Dec 10, 2008 at 12:34:26AM -0800, Junio C Hamano wrote:
> > +cat >dump <<'EOF'
> > +#!/bin/sh
> > +perl -e '$/ = undef; $_ = <>; s/./ord($&)/ge; print $_' < "$1"
> > +EOF
>
> I'll squash in a change to make this part use $SHELL_PATH for
> consistency. Thanks.
It was cut-and-paste from t4030, so if we care, it might be worth
changing there, too (and naming it "dump" instead of "hexdump", because
it actually dumps in decimal :) ).
But more importantly, the fixup you just pushed seems to have an extra
">dump":
> +{
> + echo "#!$SHELL_PATH"
> + cat >dump <<'EOF'
> +perl -e '$/ = undef; $_ = <>; s/./ord($&)/ge; print $_' < "$1"
> +EOF
> +} >dump
> +chmod +x dump
-Peff
^ permalink raw reply
* [PATCH] git-gui: Fixed typos in Swedish translation.
From: Peter Krefting @ 2008-12-10 8:50 UTC (permalink / raw)
To: Shawn O. Pearce; +Cc: Git Mailing List
In-Reply-To: <Pine.LNX.4.64.0812091623590.31023@ds9.cixit.se>
[-- Attachment #1: Type: TEXT/PLAIN, Size: 189 bytes --]
> Patch to the Swedish translation is attached gzipped.
Thanks for applying it. I found two typos, which are corrected by the
attached patch.
--
\\// Peter - http://www.softwolves.pp.se/
[-- Attachment #2: [PATCH] git-gui: Fixed typos in Swedish translation. --]
[-- Type: APPLICATION/octet-stream, Size: 757 bytes --]
^ permalink raw reply
* Re: [PATCH 3/3] gitweb: A bit of code cleanup in git_blame()
From: Junio C Hamano @ 2008-12-10 8:35 UTC (permalink / raw)
To: Jakub Narebski; +Cc: git
In-Reply-To: <ghn8jv$hg9$1@ger.gmane.org>
Jakub Narebski <jnareb@gmail.com> writes:
> Jakub Narebski wrote:
>
> I'm sorry, there should be
>
> + my $ftype = "blob";
>> if (!defined $hash) {
>> $hash = git_get_hash_by_path($hash_base, $file_name, "blob")
>> or die_error(404, "Error looking up file");
>> + } else {
>> + $ftype = git_get_type($hash);
>> + if ($ftype !~ "blob") {
>> + die_error(400, "Object is not a blob");
>> + }
I will squash in the following and queue [1/3] and [3/3] to 'pu', as there
seem to be a few comments on [2/3] that look worth addressing.
gitweb/gitweb.perl | 6 ++++--
1 files changed, 4 insertions(+), 2 deletions(-)
diff --git c/gitweb/gitweb.perl w/gitweb/gitweb.perl
index d491a1d..ccbf5d4 100755
--- c/gitweb/gitweb.perl
+++ w/gitweb/gitweb.perl
@@ -4585,11 +4585,12 @@ sub git_blame {
die_error(404, "Couldn't find base commit") unless $hash_base;
my %co = parse_commit($hash_base)
or die_error(404, "Commit not found");
+ my $ftype = "blob";
if (!defined $hash) {
$hash = git_get_hash_by_path($hash_base, $file_name, "blob")
or die_error(404, "Error looking up file");
} else {
- my $ftype = git_get_type($hash);
+ $ftype = git_get_type($hash);
if ($ftype !~ "blob") {
die_error(400, "Object is not a blob");
}
@@ -4637,7 +4638,8 @@ HTML
$metainfo{$full_rev} = {};
}
my $meta = $metainfo{$full_rev};
- while (my $data = <$fd>) {
+ my $data;
+ while ($data = <$fd>) {
chomp $data;
last if ($data =~ s/^\t//); # contents of line
if ($data =~ /^(\S+) (.*)$/) {
^ permalink raw reply related
* Re: [PATCH 1/2] diff: fix handling of binary rewrite diffs
From: Junio C Hamano @ 2008-12-10 8:34 UTC (permalink / raw)
To: Jeff King; +Cc: git
In-Reply-To: <20081209081227.GA19626@coredump.intra.peff.net>
Jeff King <peff@peff.net> writes:
> Instead, if we have binary files, then let's just skip emit_rewrite_diff
> altogether. We will already have shown the "dissimilarity index" line,
> so it is really about the diff contents. If binary diffs are turned off,
> the "Binary files a/file and b/file differ" message should be the same
> in either case. If we do have binary patches turned on, there isn't much
> point in making a less-efficient binary patch that does a total rewrite;
> no human is going to read it, and since binary patches don't apply with
> any fuzz anyway, the result of application should be the same.
Makes sense.
> diff.c | 4 ++-
> t/t4031-diff-rewrite-binary.sh | 42 ++++++++++++++++++++++++++++++++++++++++
> 2 files changed, 45 insertions(+), 1 deletions(-)
> create mode 100755 t/t4031-diff-rewrite-binary.sh
>
> diff --git a/diff.c b/diff.c
> index f644947..ea958a2 100644
> --- a/diff.c
> +++ b/diff.c
> @@ -1376,7 +1376,9 @@ static void builtin_diff(const char *name_a,
> */
> if ((one->mode ^ two->mode) & S_IFMT)
> goto free_ab_and_return;
> - if (complete_rewrite) {
> + if (complete_rewrite &&
> + !diff_filespec_is_binary(one) &&
> + !diff_filespec_is_binary(two)) {
> emit_rewrite_diff(name_a, name_b, one, two, o);
> o->found_changes = 1;
> goto free_ab_and_return;
And looks correct.
> diff --git a/t/t4031-diff-rewrite-binary.sh b/t/t4031-diff-rewrite-binary.sh
> new file mode 100755
> index 0000000..4b522f7
> --- /dev/null
> +++ b/t/t4031-diff-rewrite-binary.sh
> @@ -0,0 +1,42 @@
> +#!/bin/sh
> +
> +test_description='rewrite diff on binary file'
> +
> +. ./test-lib.sh
> +
> +# We must be large enough to meet the MINIMUM_BREAK_SIZE
> +# requirement.
> +make_file() {
> + for i in 1 2 3 4 5 6 7 8 9 10; do
> + for j in 1 2 3 4 5 6 7 9 10; do
> + for k in 1 2 3 4 5; do
> + printf "$1\n"
> + done
> + done
> + done >file
> +}
> +
> +test_expect_success 'create binary file with changes' '
> + make_file "\\0" &&
> + git add file &&
> + make_file "\\01"
> +'
Hmm... "1 2 3 4 5 6 7 9 10"?
^ permalink raw reply
* Re: [PATCH 2/2] diff: respect textconv in rewrite diffs
From: Junio C Hamano @ 2008-12-10 8:34 UTC (permalink / raw)
To: Jeff King; +Cc: git
In-Reply-To: <20081209081321.GA19707@coredump.intra.peff.net>
Jeff King <peff@peff.net> writes:
> Currently we just skip rewrite diffs for binary files; this patch makes
> an exception for files which will be textconv'd, and actually performs
> the textconv before generating the diff.
>
> Conceptually, rewrite diffs should be in the exact same format as the a
> non-rewrite diff, except that we refuse to share any context. Thus it
> makes very little sense for "git diff" to show a textconv'd diff, but
> for "git diff -B" to show "Binary files differ".
Makes sense.
> +cat >dump <<'EOF'
> +#!/bin/sh
> +perl -e '$/ = undef; $_ = <>; s/./ord($&)/ge; print $_' < "$1"
> +EOF
I'll squash in a change to make this part use $SHELL_PATH for
consistency. Thanks.
^ permalink raw reply
* Re: [PATCH] make sure packs to be replaced are closed beforehand
From: Junio C Hamano @ 2008-12-10 8:27 UTC (permalink / raw)
To: Johannes Sixt; +Cc: Nicolas Pitre, Alex Riesen, Git Mailing List
In-Reply-To: <493F71B7.60804@viscovery.net>
Johannes Sixt <j.sixt@viscovery.net> writes:
> Nicolas Pitre schrieb:
>> Especially on Windows where an opened file cannot be replaced, make
>> sure pack-objects always close packs it is about to replace. Even on
>> non Windows systems, this could save potential bad results if ever
>> objects were to be read from the new pack file using offset from the old
>> index.
>>
>> This should fix t5303 on Windows.
> ...
>> OK, here it is at last. Please confirm it works on Windows before Junio
>> merges it.
>
> I can confirm that this patch fixes t5303 on Windows (MinGW).
Thanks; it is a bit too late for tonight, but it will appear in tomorrow's
'master'.
^ permalink raw reply
* Re: git fsck segmentation fault
From: Martin Koegler @ 2008-12-10 7:53 UTC (permalink / raw)
To: Nicolas Pitre; +Cc: Simon Hausmann, Git Mailing List
In-Reply-To: <alpine.LFD.2.00.0812091408560.14328@xanadu.home>
Maybe something like this could help:
>From 32be177cbb0825fc019200b172f3d79117b28140 Mon Sep 17 00:00:00 2001
From: Martin Koegler <mkoegler@auto.tuwien.ac.at>
Date: Wed, 10 Dec 2008 08:42:08 +0100
Subject: [PATCH] fsck: use fewer stack
This patch moves the state while traversing the tree
from the stack to the heap.
Not-really-tested-by: Martin Koegler
Signed-off-by: Martin Koegler <mkoegler@auto.tuwien.ac.at>
---
builtin-fsck.c | 19 +++++++++++++++++--
1 files changed, 17 insertions(+), 2 deletions(-)
diff --git a/builtin-fsck.c b/builtin-fsck.c
index afded5e..8184699 100644
--- a/builtin-fsck.c
+++ b/builtin-fsck.c
@@ -36,6 +36,9 @@ static int verbose;
#define DIRENT_SORT_HINT(de) ((de)->d_ino)
#endif
+static int objectstack_nr, objectstack_alloc;
+struct object **objectstack;
+
static void objreport(struct object *obj, const char *severity,
const char *err, va_list params)
{
@@ -66,9 +69,7 @@ static int fsck_error_func(struct object *obj, int type, const char *err, ...)
static int mark_object(struct object *obj, int type, void *data)
{
- struct tree *tree = NULL;
struct object *parent = data;
- int result;
if (!obj) {
printf("broken link from %7s %s\n",
@@ -95,6 +96,15 @@ static int mark_object(struct object *obj, int type, void *data)
}
return 1;
}
+ ALLOC_GROW(objectstack, objectstack_nr + 1, objectstack_alloc);
+ objectstack[objectstack_nr++] = obj;
+ return 0;
+}
+
+static int mark_child_object(struct object *obj)
+{
+ struct tree *tree = NULL;
+ int result;
if (obj->type == OBJ_TREE) {
obj->parsed = 0;
@@ -116,6 +126,11 @@ static int mark_object(struct object *obj, int type, void *data)
static void mark_object_reachable(struct object *obj)
{
mark_object(obj, OBJ_ANY, 0);
+ while (objectstack_nr > 0) {
+ struct object *obj = objectstack[--objectstack_nr];
+ if (mark_child_object(obj) < 0)
+ break;
+ }
}
static int mark_used(struct object *obj, int type, void *data)
--
1.6.1.rc2.283.g32be1
^ permalink raw reply related
* Re: [PATCH] make sure packs to be replaced are closed beforehand
From: Johannes Sixt @ 2008-12-10 7:37 UTC (permalink / raw)
To: Nicolas Pitre; +Cc: Alex Riesen, Junio C Hamano, Git Mailing List
In-Reply-To: <alpine.LFD.2.00.0812091414030.14328@xanadu.home>
Nicolas Pitre schrieb:
> Especially on Windows where an opened file cannot be replaced, make
> sure pack-objects always close packs it is about to replace. Even on
> non Windows systems, this could save potential bad results if ever
> objects were to be read from the new pack file using offset from the old
> index.
>
> This should fix t5303 on Windows.
...
> OK, here it is at last. Please confirm it works on Windows before Junio
> merges it.
I can confirm that this patch fixes t5303 on Windows (MinGW).
-- Hannes
^ permalink raw reply
* Re: [PATCH 3/3] gitweb: A bit of code cleanup in git_blame()
From: Luben Tuikov @ 2008-12-10 6:24 UTC (permalink / raw)
To: git, Jakub Narebski
In-Reply-To: <20081209224814.28106.83387.stgit@localhost.localdomain>
--- On Tue, 12/9/08, Jakub Narebski <jnareb@gmail.com> wrote:
> From: Jakub Narebski <jnareb@gmail.com>
> Subject: [PATCH 3/3] gitweb: A bit of code cleanup in git_blame()
> To: git@vger.kernel.org
> Cc: "Luben Tuikov" <ltuikov@yahoo.com>, "Jakub Narebski" <jnareb@gmail.com>
> Date: Tuesday, December 9, 2008, 2:48 PM
> Among others:
> * move variable declaration closer to the place it is set
> and used,
> if possible,
> * uniquify and simplify coding style a bit, which includes
> removing
> unnecessary '()'.
> * check type only if $hash was defined, as otherwise from
> the way
> git_get_hash_by_path() is called (and works), we know
> that it is
> a blob,
> * use modern calling convention for git-blame,
> * remove unused variable,
> * don't use implicit variables ($_),
> * add some comments
>
> Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Acked-by: Luben Tuikov <ltuikov@yahoo.com>
Looks good.
> ---
> Not stricly necessary... but the code looked not very nice
>
> gitweb/gitweb.perl | 65
> ++++++++++++++++++++++++++++++----------------------
> 1 files changed, 37 insertions(+), 28 deletions(-)
>
> diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
> index 916396a..68aa3f8 100755
> --- a/gitweb/gitweb.perl
> +++ b/gitweb/gitweb.perl
> @@ -4575,28 +4575,32 @@ sub git_tag {
> }
>
> sub git_blame {
> - my $fd;
> - my $ftype;
> -
> + # permissions
> gitweb_check_feature('blame')
> - or die_error(403, "Blame view not
> allowed");
> + or die_error(403, "Blame view not allowed");
>
> + # error checking
> die_error(400, "No file name given") unless
> $file_name;
> $hash_base ||= git_get_head_hash($project);
> - die_error(404, "Couldn't find base commit")
> unless ($hash_base);
> + die_error(404, "Couldn't find base commit")
> unless $hash_base;
> my %co = parse_commit($hash_base)
> or die_error(404, "Commit not found");
> if (!defined $hash) {
> $hash = git_get_hash_by_path($hash_base, $file_name,
> "blob")
> or die_error(404, "Error looking up file");
> + } else {
> + my $ftype = git_get_type($hash);
> + if ($ftype !~ "blob") {
> + die_error(400, "Object is not a blob");
> + }
> }
> - $ftype = git_get_type($hash);
> - if ($ftype !~ "blob") {
> - die_error(400, "Object is not a blob");
> - }
> - open ($fd, "-|", git_cmd(), "blame",
> '-p', '--',
> - $file_name, $hash_base)
> +
> + # run git-blame --porcelain
> + open my $fd, "-|", git_cmd(),
> "blame", '-p',
> + $hash_base, '--', $file_name
> or die_error(500, "Open git-blame failed");
> +
> + # page header
> git_header_html();
> my $formats_nav =
> $cgi->a({-href =>
> href(action=>"blob", -replay=>1)},
> @@ -4610,40 +4614,43 @@ sub git_blame {
> git_print_page_nav('','',
> $hash_base,$co{'tree'},$hash_base, $formats_nav);
> git_print_header_div('commit',
> esc_html($co{'title'}), $hash_base);
> git_print_page_path($file_name, $ftype, $hash_base);
> - my @rev_color = (qw(light2 dark2));
> +
> + # page body
> + my @rev_color = qw(light2 dark2);
> my $num_colors = scalar(@rev_color);
> my $current_color = 0;
> - my $last_rev;
> + my %metainfo = ();
> +
> print <<HTML;
> <div class="page_body">
> <table class="blame">
>
> <tr><th>Commit</th><th>Line</th><th>Data</th></tr>
> HTML
> - my %metainfo = ();
> - while (1) {
> - $_ = <$fd>;
> - last unless defined $_;
> + LINE:
> + while (my $line = <$fd>) {
> + chomp $line;
> + # the header: <SHA-1> <src lineno> <dst
> lineno> [<lines in group>]
> + # no <lines in group> for subsequent lines in
> group of lines
> my ($full_rev, $orig_lineno, $lineno, $group_size) =
> - /^([0-9a-f]{40}) (\d+) (\d+)(?:
> (\d+))?$/;
> + ($line =~ /^([0-9a-f]{40}) (\d+) (\d+)(?:
> (\d+))?$/);
> if (!exists $metainfo{$full_rev}) {
> $metainfo{$full_rev} = {};
> }
> my $meta = $metainfo{$full_rev};
> - while (<$fd>) {
> - last if (s/^\t//);
> - if (/^(\S+) (.*)$/) {
> + while (my $data = <$fd>) {
> + chomp $data;
> + last if ($data =~ s/^\t//); # contents of line
> + if ($data =~ /^(\S+) (.*)$/) {
> $meta->{$1} = $2;
> }
> }
> - my $data = $_;
> - chomp $data;
> - my $rev = substr($full_rev, 0, 8);
> + my $short_rev = substr($full_rev, 0, 8);
> my $author = $meta->{'author'};
> - my %date = parse_date($meta->{'author-time'},
> - $meta->{'author-tz'});
> + my %date =
> + parse_date($meta->{'author-time'},
> $meta->{'author-tz'});
> my $date = $date{'iso-tz'};
> if ($group_size) {
> - $current_color = ++$current_color % $num_colors;
> + $current_color = ($current_color + 1) % $num_colors;
> }
> print "<tr id=\"l$lineno\"
> class=\"$rev_color[$current_color]\">\n";
> if ($group_size) {
> @@ -4654,7 +4661,7 @@ HTML
> print $cgi->a({-href =>
> href(action=>"commit",
> hash=>$full_rev,
>
> file_name=>$file_name)},
> - esc_html($rev));
> + esc_html($short_rev));
> print "</td>\n";
> }
> my $parent_commit;
> @@ -4683,6 +4690,8 @@ HTML
> print "</div>";
> close $fd
> or print "Reading blob failed\n";
> +
> + # page footer
> git_footer_html();
> }
^ permalink raw reply
* Re: [PATCH 2/3] gitweb: Cache $parent_commit info in git_blame()
From: Luben Tuikov @ 2008-12-10 6:20 UTC (permalink / raw)
To: git, Jakub Narebski
In-Reply-To: <20081209224622.28106.89325.stgit@localhost.localdomain>
--- On Tue, 12/9/08, Jakub Narebski <jnareb@gmail.com> wrote:
> From: Jakub Narebski <jnareb@gmail.com>
> Subject: [PATCH 2/3] gitweb: Cache $parent_commit info in git_blame()
> To: git@vger.kernel.org
> Cc: "Luben Tuikov" <ltuikov@yahoo.com>, "Jakub Narebski" <jnareb@gmail.com>
> Date: Tuesday, December 9, 2008, 2:48 PM
> Luben Tuikov changed 'lineno' link from leading to
> commit which lead
> to current version of given block of lines, to leading to
> parent of
> this commit in 244a70e (Blame "linenr" link jumps
> to previous state at
> "orig_lineno"). This supposedly made data mining
> possible (or just
> better).
Before 244a70e, clicking on linenr links would display
the same commit id as displayed to the left, which is no
different than the block of lines displayed, thus data
mining was impossible, i.e. I had to manually (commands)
go back in history to see how this line or block of lines
developed and/or changed.
244a70e didn't make data mining perfect, just possible.
> This patch attempts to migitate issue a bit by caching
> $parent_commit
> info in %metainfo, which makes gitweb to call git-rev-parse
> only once
> per unique commit in blame output.
Have you tested this patch that it gives the same commit chain
as before it?
Luben
>
> Signed-off-by: Jakub Narebski <jnareb@gmail.com>
> ---
> That is what I have noticed during browsing git_blame()
> code.
What?
> We can change it to even more effective implementation
> (like the ones
> proposed above in the commit message) later.
Where?
>
> Indenting is cause for artifically large diff
>
> gitweb/gitweb.perl | 16 +++++++++++-----
> 1 files changed, 11 insertions(+), 5 deletions(-)
>
> diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
> index 1b800f4..916396a 100755
> --- a/gitweb/gitweb.perl
> +++ b/gitweb/gitweb.perl
> @@ -4657,11 +4657,17 @@ HTML
> esc_html($rev));
> print "</td>\n";
> }
> - open (my $dd, "-|", git_cmd(),
> "rev-parse", "$full_rev^")
> - or die_error(500, "Open git-rev-parse
> failed");
> - my $parent_commit = <$dd>;
> - close $dd;
> - chomp($parent_commit);
> + my $parent_commit;
> + if (!exists $meta->{'parent'}) {
> + open (my $dd, "-|", git_cmd(),
> "rev-parse", "$full_rev^")
> + or die_error(500, "Open git-rev-parse
> failed");
> + $parent_commit = <$dd>;
> + close $dd;
> + chomp($parent_commit);
> + $meta->{'parent'} = $parent_commit;
> + } else {
> + $parent_commit = $meta->{'parent'};
> + }
> my $blamed = href(action => 'blame',
> file_name =>
> $meta->{'filename'},
> hash_base => $parent_commit);
^ permalink raw reply
* Re: [PATCH 1/3] gitweb: Move 'lineno' id from link to row element in git_blame
From: Luben Tuikov @ 2008-12-10 5:55 UTC (permalink / raw)
To: git, Jakub Narebski
In-Reply-To: <20081209224330.28106.18301.stgit@localhost.localdomain>
--- On Tue, 12/9/08, Jakub Narebski <jnareb@gmail.com> wrote:
> From: Jakub Narebski <jnareb@gmail.com>
> Subject: [PATCH 1/3] gitweb: Move 'lineno' id from link to row element in git_blame
> To: git@vger.kernel.org
> Cc: "Luben Tuikov" <ltuikov@yahoo.com>, "Jakub Narebski" <jnareb@gmail.com>
> Date: Tuesday, December 9, 2008, 2:46 PM
> Move l<line number> ID from <a> link element
> inside table row (inside
> cell element for column with line numbers), to encompassing
> <tr> table
> row element. It was done to make it easier to manipulate
> result HTML
> with DOM, and to be able write 'blame_incremental'
> view with the same,
> or nearly the same result.
>
> Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Acked-by: Luben Tuikov <ltuikov@yahoo.com>
Luben
> ---
> For blame_incremental I need easy way to manipulate rows of
> blame
> table, to add information about blamed commits as it
> arrives.
>
> So there it is.
>
> gitweb/gitweb.perl | 3 +--
> 1 files changed, 1 insertions(+), 2 deletions(-)
>
> diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
> index 6eb370d..1b800f4 100755
> --- a/gitweb/gitweb.perl
> +++ b/gitweb/gitweb.perl
> @@ -4645,7 +4645,7 @@ HTML
> if ($group_size) {
> $current_color = ++$current_color % $num_colors;
> }
> - print "<tr
> class=\"$rev_color[$current_color]\">\n";
> + print "<tr id=\"l$lineno\"
> class=\"$rev_color[$current_color]\">\n";
> if ($group_size) {
> print "<td
> class=\"sha1\"";
> print " title=\"". esc_html($author)
> . ", $date\"";
> @@ -4667,7 +4667,6 @@ HTML
> hash_base => $parent_commit);
> print "<td
> class=\"linenr\">";
> print $cgi->a({ -href =>
> "$blamed#l$orig_lineno",
> - -id => "l$lineno",
> -class => "linenr" },
> esc_html($lineno));
> print "</td>";
^ permalink raw reply
* Re: [PATCH 2/3] gitweb: Cache $parent_commit info in git_blame()
From: Nanako Shiraishi @ 2008-12-10 3:49 UTC (permalink / raw)
To: Jakub Narebski; +Cc: git, Luben Tuikov
In-Reply-To: <20081209224622.28106.89325.stgit@localhost.localdomain>
Quoting Jakub Narebski <jnareb@gmail.com>:
> Unfortunately the implementation in 244a70e used one call for
> git-rev-parse to find parent revision per line in file, instead of
> using long lived "git cat-file --batch-check" (which might not existed
> then), or changing validate_refname to validate_revision and made it
> accept <rev>^, <rev>^^, <rev>^^^ etc. syntax.
Could you substantiate why this is "Unfortunate"? Is the new implementation faster? By how much?
When "previous" commit information is available in the output from "git blame", can you make use of it?
--
Nanako Shiraishi
http://ivory.ap.teacup.com/nanako3/
^ permalink raw reply
* Re: [PATCH 3/3] gitweb: A bit of code cleanup in git_blame()
From: Jakub Narebski @ 2008-12-10 2:13 UTC (permalink / raw)
To: git
In-Reply-To: <20081209224814.28106.83387.stgit@localhost.localdomain>
Jakub Narebski wrote:
I'm sorry, there should be
+ my $ftype = "blob";
> if (!defined $hash) {
> $hash = git_get_hash_by_path($hash_base, $file_name, "blob")
> or die_error(404, "Error looking up file");
> + } else {
> + $ftype = git_get_type($hash);
> + if ($ftype !~ "blob") {
> + die_error(400, "Object is not a blob");
> + }
--
Jakub Narebski
Warsaw, Poland
ShadeHawk on #git
^ permalink raw reply
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox