Skip to content

Commit a9fe834

Browse files
scolladonyohanim
andauthored
fix: improve deterministic ordering and remove dead code (#168)
Co-authored-by: yohanim <2168165+yohanim@users.noreply.github.com>
1 parent c3317bc commit a9fe834

File tree

8 files changed

+390
-434
lines changed

8 files changed

+390
-434
lines changed

README.md

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,11 @@ An intelligent Git merge driver specifically designed for Salesforce metadata fi
88
## Demo
99

1010
### Without sf-git-merge-driver
11+
1112
![Demo without sf-git-merge-driver](./docs/media/demo-without-sf-git-merge-driver.gif)
1213

1314
### With sf-git-merge-driver
15+
1416
![Demo with sf-git-merge-driver](./docs/media/demo-with-sf-git-merge-driver.gif)
1517

1618
## Why use this plugin?
@@ -45,6 +47,7 @@ This merge driver follows the **zdiff3** conflict style philosophy:
4547
- **Respects Git configuration**: Conflict marker size and labels are configurable via Git's standard parameters (`-L`, `-S`, `-X`, `-Y` flags)
4648

4749
Example conflict output:
50+
4851
```xml
4952
<<<<<<< ours
5053
<field>localValue</field>
@@ -56,6 +59,7 @@ Example conflict output:
5659
```
5760

5861
This approach helps you understand:
62+
5963
1. What the original value was (`base`)
6064
2. What your branch changed it to (`ours`)
6165
3. What the other branch changed it to (`theirs`)
@@ -69,6 +73,7 @@ For metadata types where **element order matters** (like picklist values), the m
6973
- **Additions respect position**: New elements are inserted at their intended position
7074

7175
**Supported ordered metadata:**
76+
7277
- `GlobalValueSet` / `StandardValueSet` → picklist values
7378
- `CustomField` → value set entries
7479
- `RecordType` → picklist value assignments
@@ -97,9 +102,11 @@ sf git merge driver install
97102
## Usage
98103

99104
The merge driver activates **automatically** for conflicts on:
105+
100106
- [Full list of supported metadata](#configuration)
101107

102108
**No additional steps required!** Works during normal Git operations:
109+
103110
```bash
104111
git pull # Conflicts resolved automatically
105112
git merge # Same here
@@ -108,6 +115,7 @@ git merge # Same here
108115
## Configuration
109116

110117
Configured for these metadata files by default:
118+
111119
```gitattributes
112120
*.profile-meta.xml merge=salesforce-source
113121
*.permissionset-meta.xml merge=salesforce-source
@@ -161,30 +169,35 @@ Configured for these metadata files by default:
161169
## How to disable it for a specific merge
162170

163171
When you don't want to use the merge driver for a specific merge, just backup the `.git/info/attributes` file and put it back after the merge.
172+
164173
```sh
165174
mv .git/info/attributes .git/info/attributes.bak
166175
git merge <branch>
167176
mv .git/info/attributes.bak .git/info/attributes
168177
```
169178

170179
If you want to disable the merge driver for a specific file, just comment the merge driver configuration from the `.git/info/attributes` file.
180+
171181
```sh
172182
# *.profile-meta.xml merge=salesforce-source
173183
```
174184

175-
If you want to disable it for all the project, just uninstall the driver:
185+
If you want to disable it for all the project, just uninstall the driver:
186+
176187
```sh
177188
sf git merge driver uninstall
178189
```
179190

180191
## How to know if it is installed and enabled ?
181192

182193
You can check if the merge driver is installed by running the following command:
194+
183195
```sh
184196
git config --show-origin --get-regexp '^merge.salesforce-source(\..*)?'
185197
```
186198

187199
You can check if the merge driver is enabled by running the following command:
200+
188201
```sh
189202
grep "merge=salesforce-source" .git/info/attributes
190203
```
@@ -317,7 +330,7 @@ EXAMPLES
317330
$ sf git merge driver install
318331
```
319332

320-
_See code: [src/commands/git/merge/driver/install.ts](https://github.com/scolladon/sf-git-merge-driver/blob/v1.4.1/src/commands/git/merge/driver/install.ts)_
333+
_See code: [src/commands/git/merge/driver/install.ts](https://github.com/scolladon/sf-git-merge-driver/blob/main/src/commands/git/merge/driver/install.ts)_
321334

322335
## `sf git merge driver run`
323336

@@ -361,7 +374,7 @@ EXAMPLES
361374
- output-file is the path to the file where the merged content will be written
362375
```
363376

364-
_See code: [src/commands/git/merge/driver/run.ts](https://github.com/scolladon/sf-git-merge-driver/blob/v1.4.1/src/commands/git/merge/driver/run.ts)_
377+
_See code: [src/commands/git/merge/driver/run.ts](https://github.com/scolladon/sf-git-merge-driver/blob/main/src/commands/git/merge/driver/run.ts)_
365378

366379
## `sf git merge driver uninstall`
367380

@@ -391,8 +404,9 @@ EXAMPLES
391404
$ sf git merge driver uninstall
392405
```
393406

394-
_See code: [src/commands/git/merge/driver/uninstall.ts](https://github.com/scolladon/sf-git-merge-driver/blob/v1.4.1/src/commands/git/merge/driver/uninstall.ts)_
407+
_See code: [src/commands/git/merge/driver/uninstall.ts](https://github.com/scolladon/sf-git-merge-driver/blob/main/src/commands/git/merge/driver/uninstall.ts)_
395408
<!-- commandsstop -->
409+
396410
## Changelog
397411

398412
[changelog.md](CHANGELOG.md) is available for consultation.

0 commit comments

Comments
 (0)