Skip to content

Commit c5d4a68

Browse files
author
Nick Hwang
committed
Add script for continuing difftool
1 parent a16954e commit c5d4a68

File tree

2 files changed

+32
-22
lines changed

2 files changed

+32
-22
lines changed

bin/difftool

Lines changed: 30 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -30,32 +30,41 @@ function rename() {
3030
mv "$2" "$1"
3131
}
3232

33-
# Add Airbnb git remote
34-
if [[ -z $(git remote -v | grep -e "$AIRBNB_REMOTE\s\+$AIRBNB_GIT\s\+(fetch)") ]]; then
35-
git remote add "$AIRBNB_REMOTE" "$AIRBNB_GIT"
36-
fi
33+
function difftool() {
34+
git difftool --prompt "$COMPARATE_BRANCH"
35+
}
3736

38-
# Stash any existing changes before diffing
39-
git stash save "$STASH_MESSAGE"
37+
if [[ "$1" != "--continue" ]]; then
38+
# Add Airbnb git remote
39+
if [[ -z $(git remote -v | grep -e "$AIRBNB_REMOTE\s\+$AIRBNB_GIT\s\+(fetch)") ]]; then
40+
git remote add "$AIRBNB_REMOTE" "$AIRBNB_GIT"
41+
fi
4042

41-
# Checkout working branch
42-
checkout "$WORKING_BRANCH"
43+
# Stash any existing changes before diffing
44+
git stash save "$STASH_MESSAGE"
4345

44-
# Fetch Airbnb changes
45-
git fetch "$AIRBNB_REMOTE" "$REMOTE_BRANCH"
46+
# Checkout working branch
47+
checkout "$WORKING_BRANCH"
4648

47-
# Checkout Airbnb remote branch
48-
checkout "$COMPARATE_BRANCH" "$AIRBNB_REMOTE/$REMOTE_BRANCH"
49+
# Fetch Airbnb changes
50+
git fetch "$AIRBNB_REMOTE" "$REMOTE_BRANCH"
4951

50-
# Rename eslint-config-airbnb to eslint-config-hubspot for diffing
51-
rename "$ESLINT_HUBSPOT" "$ESLINT_AIRBNB"
52+
# Checkout Airbnb remote branch
53+
checkout "$COMPARATE_BRANCH" "$AIRBNB_REMOTE/$REMOTE_BRANCH"
5254

53-
# Commit rename for diffing
54-
git add "$ESLINT_AIRBNB" "$ESLINT_HUBSPOT"
55-
git commit -m "$COMMIT_MESSAGE"
55+
# Rename eslint-config-airbnb to eslint-config-hubspot for diffing
56+
rename "$ESLINT_HUBSPOT" "$ESLINT_AIRBNB"
5657

57-
# Checkout last branch to begin diffing
58-
git checkout "$WORKING_BRANCH"
58+
# Commit rename for diffing
59+
git add "$ESLINT_AIRBNB" "$ESLINT_HUBSPOT"
60+
git commit -m "$COMMIT_MESSAGE"
5961

60-
# Begin diffing
61-
git difftool --prompt "$COMPARATE_BRANCH"
62+
# Checkout last branch to begin diffing
63+
git checkout "$WORKING_BRANCH"
64+
65+
# Begin diffing
66+
difftool
67+
else
68+
# Continue difftool
69+
difftool
70+
fi

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
"description": "HubSpot's version of a mostly reasonable approach to JavaScript",
55
"scripts": {
66
"difftool": "./bin/difftool",
7-
"cleanup": "./bin/cleanup",
7+
"difftool:continue": "./bin/difftool --continue",
8+
"difftool:cleanup": "./bin/cleanup",
89
"publish:config": "cd packages/eslint-config-hubspot && npm publish",
910
"publish:all": "npm publish && npm run publish:config"
1011
},

0 commit comments

Comments
 (0)