xaizek / zograscope (License: AGPLv3 only) (since 2018-12-07)
Mainly a syntax-aware diff that also provides a number of additional tools.
Commit 1cd248fa0a95d4400c3fca44a40d8f8317332999

Improve logic of finding attributes in zs-diff
Both files in git-show are temporary ones, so just use new path. The
path doesn't even need to exist to be matched against list of
attributes.

zs-gdiff didn't have this problem as it uses in-memory files and already
was guided by a path.
Author: xaizek
Author date (UTC): 2022-07-04 15:21
Committer name: xaizek
Committer date (UTC): 2022-07-04 15:25
Parent(s): 22828512356d7f52f6bc49e07abada629668335a
Signing key: 99DC5E4DB05F6BE2
Tree: 47bb21f3069f1e9be4d9e90c2ae811c2175042c8
File Lines added Lines deleted
tools/diff/diff.cpp 6 3
tools/gdiff/ZSDiff.cpp 3 1
File tools/diff/diff.cpp changed (mode: 100644) (index ed873e7..6be527d)
... ... run(Environment &env, const Args &args)
143 143 const std::string oldFile = (args.gitDiff ? args.pos[1] : args.pos[0]); const std::string oldFile = (args.gitDiff ? args.pos[1] : args.pos[0]);
144 144 const std::string newFile = (args.gitDiff ? args.pos[4] : args.pos[1]); const std::string newFile = (args.gitDiff ? args.pos[4] : args.pos[1]);
145 145
146 // New file should be in-tree.
147 Attrs attrs = env.getConfig().lookupAttrs(newFile);
146 const int newNameIdx = (args.gitRename ? 7 : 0);
147
148 // Using new file for attributes under assumption that it better matches
149 // user's expectations (e.g., new location reflects file's properties
150 // better).
151 Attrs attrs = env.getConfig().lookupAttrs(args.pos[newNameIdx]);
148 152
149 153 TimeReport &tr = env.getTimeKeeper(); TimeReport &tr = env.getTimeKeeper();
150 154 TimeReport nestedTr(tr); TimeReport nestedTr(tr);
 
... ... run(Environment &env, const Args &args)
186 190 std::cout); std::cout);
187 191 if (args.gitDiff) { if (args.gitDiff) {
188 192 printer.addHeader({ args.pos[3], args.pos[6] }); printer.addHeader({ args.pos[3], args.pos[6] });
189 const int newNameIdx = (args.gitRename ? 7 : 0);
190 193 printer.addHeader({ "a/" + args.pos[0], "b/" + args.pos[newNameIdx] }); printer.addHeader({ "a/" + args.pos[0], "b/" + args.pos[newNameIdx] });
191 194 } else { } else {
192 195 printer.addHeader({ oldFile, newFile }); printer.addHeader({ oldFile, newFile });
File tools/gdiff/ZSDiff.cpp changed (mode: 100644) (index 9d92d0b..04ca9ac)
... ... ZSDiff::loadDiff(const DiffEntry &diffEntry)
302 302
303 303 updateTitle(); updateTitle();
304 304
305 // New file should be in-tree.
305 // Using new file for attributes under assumption that it better matches
306 // user's expectations (e.g., new location reflects file's properties
307 // better).
306 308 Attrs attrs = env.getConfig().lookupAttrs(diffEntry.updated.path); Attrs attrs = env.getConfig().lookupAttrs(diffEntry.updated.path);
307 309
308 310 // TODO: parse in parallel like zs-diff does. // TODO: parse in parallel like zs-diff does.
Hints

Before first commit, do not forget to setup your git environment:
git config --global user.name "your_name_here"
git config --global user.email "your@email_here"

Clone this repository using HTTP(S):
git clone https://code.reversed.top/user/xaizek/zograscope

Clone this repository using ssh (do not forget to upload a key first):
git clone ssh://rocketgit@code.reversed.top/user/xaizek/zograscope

You are allowed to anonymously push to this repository.
This means that your pushed commits will automatically be transformed into a pull request:
... clone the repository ...
... make some changes and some commits ...
git push origin master