Tool/Method to detect accidental (partial) revert?

For discussions about programming, programming questions/advice, and projects that don't really have anything to do with Puppy.
Post Reply
Message
Author
disciple
Posts: 6984
Joined: Sun 21 May 2006, 01:46
Location: Auckland, New Zealand

Tool/Method to detect accidental (partial) revert?

#1 Post by disciple »

Scenario: People haven't been using their version control properly, either because they don't know how to do advanced merges and stuff, or they are in a restricted environment and only using the github web interface or similar.

Does anyone have any suggestions for analyzing the commit history (git in this case) and detecting bits of code that might have been accidentally reverted? The best I can think of is creating a patch file for each commit and doing some sort of comparison of all the patch files. But maybe there is even some advanced way of viewing commit history that would be helpful?

Thanks.
Do you know a good gtkdialog program? Please post a link here

Classic Puppy quotes

ROOT FOREVER
GTK2 FOREVER

User avatar
01micko
Posts: 8741
Joined: Sat 11 Oct 2008, 13:39
Location: qld
Contact:

#2 Post by 01micko »

try this

Code: Select all

git log -p <path> # relpath/to/suspect/
I suppose you can loop through all paths and redirect to a file because it could get rather long in a vt. It prints out the diffs.

EDIT0: I took the liberty of writing a crude script. The script depends on being run in a git repo directory and a commit date to go back to. Woof results are attached too and it has a .diff extension for syntax highlighting, for geany at least.

EDIT1: now saves with the 'since-<commit date>' instead of today's date.e

EDIT2: a quick way to get the commit date with abbreviated sha (%h) , author name (%an) and author date (%ad):

Code: Select all

git log --pretty=format:" %h %an %ad"
Attachments
gitlogdiff.sh.gz
gunzip the file and make executable
(317 Bytes) Downloaded 101 times
gitlog-20200502.diff.gz
creates the log in home dir
(26.99 KiB) Downloaded 96 times
git-log.jpg
(142.91 KiB) Downloaded 32 times
Puppy Linux Blog - contact me for access

Post Reply