Skip to content

Commit 0400e83

Browse files
hhourani27isomorphic-git-bot
authored andcommitted
fix: deleteBranch should remove branch config (#1946)
* fx: delete config entry after deleting a local branch * docs: add @hhourani27 as a contributor
1 parent 8ff6b15 commit 0400e83

File tree

6 files changed

+19
-4
lines changed

6 files changed

+19
-4
lines changed

js/isomorphic-git/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -376,6 +376,7 @@ Thanks goes to these wonderful people ([emoji key](https://github.com/kentcdodds
376376
<td align="center"><a href="https://github.com/lsegurado"><img src="https://avatars.githubusercontent.com/u/27731047?v=4?s=60" width="60px;" alt=""/><br /><sub><b>Lucas Martin Segurado</b></sub></a><br /><a href="https://github.com/isomorphic-git/isomorphic-git/commits?author=lsegurado" title="Documentation">📖</a> <a href="https://github.com/isomorphic-git/isomorphic-git/issues?q=author%3Alsegurado" title="Bug reports">🐛</a></td>
377377
<td align="center"><a href="https://github.com/limond"><img src="https://avatars.githubusercontent.com/u/1025682?v=4?s=60" width="60px;" alt=""/><br /><sub><b>Leon Kaucher</b></sub></a><br /><a href="https://github.com/isomorphic-git/isomorphic-git/commits?author=limond" title="Code">💻</a> <a href="https://github.com/isomorphic-git/isomorphic-git/commits?author=limond" title="Tests">⚠️</a></td>
378378
<td align="center"><a href="https://github.com/gilisho"><img src="https://avatars.githubusercontent.com/u/40733156?v=4?s=60" width="60px;" alt=""/><br /><sub><b>Gili Shohat</b></sub></a><br /><a href="https://github.com/isomorphic-git/isomorphic-git/commits?author=gilisho" title="Code">💻</a> <a href="https://github.com/isomorphic-git/isomorphic-git/commits?author=gilisho" title="Documentation">📖</a> <a href="https://github.com/isomorphic-git/isomorphic-git/commits?author=gilisho" title="Tests">⚠️</a></td>
379+
<td align="center"><a href="https://github.com/hhourani27"><img src="https://avatars.githubusercontent.com/u/61935766?v=4?s=60" width="60px;" alt=""/><br /><sub><b>Habib</b></sub></a><br /><a href="https://github.com/isomorphic-git/isomorphic-git/commits?author=hhourani27" title="Code">💻</a> <a href="https://github.com/isomorphic-git/isomorphic-git/commits?author=hhourani27" title="Documentation">📖</a> <a href="https://github.com/isomorphic-git/isomorphic-git/commits?author=hhourani27" title="Tests">⚠️</a></td>
379380
</tr>
380381
</table>
381382

js/isomorphic-git/index.cjs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1565,6 +1565,7 @@ const SECTION_REGEX = /^[A-Za-z0-9-.]+$/;
15651565
const VARIABLE_LINE_REGEX = /^([A-Za-z][A-Za-z-]*)(?: *= *(.*))?$/;
15661566
const VARIABLE_NAME_REGEX = /^[A-Za-z][A-Za-z-]*$/;
15671567

1568+
// Comments start with either # or ; and extend to the end of line
15681569
const VARIABLE_VALUE_COMMENT_REGEX = /^(.*?)( *[#;].*)$/;
15691570

15701571
const extractSectionLine = line => {
@@ -8574,6 +8575,12 @@ async function _deleteBranch({ fs, gitdir, ref }) {
85748575

85758576
// Delete a specified branch
85768577
await GitRefManager.deleteRef({ fs, gitdir, ref: fullRef });
8578+
8579+
// Delete branch config entries
8580+
const abbrevRef = abbreviateRef(ref);
8581+
const config = await GitConfigManager.get({ fs, gitdir });
8582+
await config.deleteSection('branch', abbrevRef);
8583+
await GitConfigManager.save({ fs, gitdir, config });
85778584
}
85788585

85798586
// @ts-check

js/isomorphic-git/index.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1559,6 +1559,7 @@ const SECTION_REGEX = /^[A-Za-z0-9-.]+$/;
15591559
const VARIABLE_LINE_REGEX = /^([A-Za-z][A-Za-z-]*)(?: *= *(.*))?$/;
15601560
const VARIABLE_NAME_REGEX = /^[A-Za-z][A-Za-z-]*$/;
15611561

1562+
// Comments start with either # or ; and extend to the end of line
15621563
const VARIABLE_VALUE_COMMENT_REGEX = /^(.*?)( *[#;].*)$/;
15631564

15641565
const extractSectionLine = line => {
@@ -8568,6 +8569,12 @@ async function _deleteBranch({ fs, gitdir, ref }) {
85688569

85698570
// Delete a specified branch
85708571
await GitRefManager.deleteRef({ fs, gitdir, ref: fullRef });
8572+
8573+
// Delete branch config entries
8574+
const abbrevRef = abbreviateRef(ref);
8575+
const config = await GitConfigManager.get({ fs, gitdir });
8576+
await config.deleteSection('branch', abbrevRef);
8577+
await GitConfigManager.save({ fs, gitdir, config });
85718578
}
85728579

85738580
// @ts-check

js/isomorphic-git/index.umd.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

js/isomorphic-git/index.umd.min.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

js/isomorphic-git/size_report.html

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)