troxy-cli 1.30.17 → 1.30.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -116,12 +116,10 @@ const RULES = [
|
|
|
116
116
|
const paths = pathArgs(segment, 2).filter((w) => !w.startsWith('-'));
|
|
117
117
|
return { action_verb: 'delete', resource: summarizeResource(paths, 'a branch'), item_count: 1 };
|
|
118
118
|
}
|
|
119
|
-
if (/^git\s+push\b/.test(segment) && (/\s--delete\b/.test(segment) || /\s
|
|
120
|
-
// `git push origin :branch`
|
|
121
|
-
// `git push origin
|
|
122
|
-
|
|
123
|
-
// touched, which is what matters here regardless of which it deletes.
|
|
124
|
-
const target = segment.match(/--delete\s+(\S+)/)?.[1] || segment.match(/\s\S*:(\S+)/)?.[1];
|
|
119
|
+
if (/^git\s+push\b/.test(segment) && (/\s--delete\b/.test(segment) || /\s:\S+/.test(segment))) {
|
|
120
|
+
// Only an empty source (`git push origin :branch`) deletes.
|
|
121
|
+
// `git push origin HEAD:main` is a normal push, not a delete.
|
|
122
|
+
const target = segment.match(/--delete\s+(\S+)/)?.[1] || segment.match(/\s:(\S+)/)?.[1];
|
|
125
123
|
return { action_verb: 'delete', resource: target || 'a remote branch', item_count: 1 };
|
|
126
124
|
}
|
|
127
125
|
return null;
|
|
@@ -86,6 +86,10 @@ describe('actionFor - git force push / branch delete', () => {
|
|
|
86
86
|
assert.equal(bash('git push origin --delete old-feature').action_verb, 'delete');
|
|
87
87
|
assert.equal(bash('git push origin :old-feature').action_verb, 'delete');
|
|
88
88
|
});
|
|
89
|
+
|
|
90
|
+
it('does not treat a normal src:dst push as a delete', () => {
|
|
91
|
+
assert.equal(bash('git push -q origin HEAD:main'), null);
|
|
92
|
+
});
|
|
89
93
|
});
|
|
90
94
|
|
|
91
95
|
describe('actionFor - terraform / kubectl / docker / aws', () => {
|